批量更新/更新插入在MongoDB中? [英] Bulk update/upsert in MongoDB?

查看:519
本文介绍了批量更新/更新插入在MongoDB中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能做批量更新/更新插入(不插入)在MongoDB中?

Is it possible to do bulk update/upsert (not insert) in MongoDB?

如果有,请点我与此相关的任何文档?

If yes, please point me to any docs related to this?

感谢

推荐答案

您可以使用命令行程序的 mongoimport 它应该是在你的MongoDB的bin目录...

You can use the command line program mongoimport it should be in your MongoDB bin dir ...

有你要考虑使用两个选项的 UPSERT ...

There are two options you'll want to look into to use upsert ...

- 更新插入插入或
  已经存在的结果更新对象
  --upsertFields ARG逗号分隔的字段的查询
  的一部分
                            更新插入。您应该确保这个被索引

--upsert insert or update objects that already exist
--upsertFields arg comma-separated fields for the query part of the upsert. You should make sure this is indexed

更多信息: http://www.mongodb.org/display/ DOCS /导入导出+ +工具

或者只是做...

$ mongoimport --help

这篇关于批量更新/更新插入在MongoDB中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆