【发布时间】:2011-08-11 04:47:21
【问题描述】:
我有这个 JSON 的文件
{
_id : 10000000042,
OtherID: 10000000043,
}
C:\mongodb-win32-i386-1.9.0\bin>mongoimport.exe --host localhost --db crm --collection tst --file c:\temp\tst3.txt --jsonArray --upsert --upsertFields 其他ID
连接到:localhost 导入了 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 字段未更新。
我的手断了?
【问题讨论】:
标签: mongodb