Answers for "how to add a new propety into all documents in mongodb"

3

how to add a new propety into all documents in mongodb

db.users.update({}, { "$set" : { "age": 30 }}, false,true)
// users: collection name, age: new property
//false it's upsert argument, it tells mongo to not insert a new document when no match is found
// true it's multi argument, it tells mongo to update multiple documents that meet the query criteria
Posted by: Guest on September-17-2020
0

add property to all documents mongo

db.myCollection.update({}, {$set: {"isOpen": false}}, false, true)
Posted by: Guest on August-13-2020

Code answers related to "how to add a new propety into all documents in mongodb"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language