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 } 
)
https://docs.mongodb.com/manual/tutorial/update-documents/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With