I run an update
statement on a mongodb
database and it deleted my document! What did I do wrong?
This is the update statement:
db.Question.update( {Name: "IsSomeCompany"}, {ButtonValues: [0, 1, 2] } )
I am using Robomongo
and the reply was Updated 1 record(s) in 22ms
but when I checked the database the record was gone. What am I missing here?
I use this syntax for updating multiple documents.
db.getCollection('YourDocument').update(
{ "matchingField" : "matchingValue"},
{ "$set": { "field": "value" } },
{ "multi": true }
)