我update
在mongodb
数据库上运行一个语句,它删除了我的文档!我做错了什么?
这是更新声明:
db.Question.update( {Name: "IsSomeCompany"}, {ButtonValues: [0, 1, 2] } )
Run Code Online (Sandbox Code Playgroud)
我正在使用Robomongo
和回复,Updated 1 record(s) in 22ms
但当我检查数据库时,记录消失了.我在这里错过了什么?
我使用这种语法来更新多个文档.
db.getCollection('YourDocument').update(
{ "matchingField" : "matchingValue"},
{ "$set": { "field": "value" } },
{ "multi": true }
)
Run Code Online (Sandbox Code Playgroud)
https://docs.mongodb.com/manual/tutorial/update-documents/
归档时间: |
|
查看次数: |
7723 次 |
最近记录: |