我有这个JSON的文件
{
_id : 10000000042,
OtherID: 10000000043,
}C:\mongodb-win32-i386-1.9.0\bin>mongoimport.exe --主机本地主机--db -收集tst -文件c:\temp\tst3.txt -jsonArray-upsertFields
连接到:本地主机导入的1个对象
在mongo控制台:
> db.tst.find();
{ "_id" : NumberLong("10000000042"), "OtherID" : NumberLong("10000000043") }
> db.tst.getIndexes()
[
{
"name" : "_id_",
"ns" : "crm.tst",
"key" : {
"_id" : 1
},
"v" : 0
},
{
"_id" : ObjectId("4e435d7a296ca66d8f50b0e0"),
"ns" : "crm.tst",
"key" : {
"OtherID" : 1
},
"name" : "OtherID_1",
"v" : 0
}
]然后我更新我的JSON:
{
_id : 10000000042,
OtherID: 10000000044,
}并再次运行mongoimport
在控制台中:
> db.tst.find(); { "\_id" : NumberLong("10000000042"), "OtherID" :NumberLong("10000000043") }
OtherID字段不更新。
我的手断了?
发布于 2011-08-11 09:37:32
删除"upsertFields“参数,您将是黄金级的。这不是你想要做的事。
https://stackoverflow.com/questions/7020947
复制相似问题