Answers for "mongodb update all doucment"

0

mongo change all documents on field

//Update all documents with "oldName" to "newName"
db.names.updateMany({ "name": "oldName" }, {  $set: { "name" : "newName" }  })
Posted by: Guest on June-01-2020
5

mongodb update

db.collectionName.update({"aField":"vale1"},{$set:{"anotherField":"value2"}})

-search for documentations for more examples than search
-aField is used to find the documents
-anotherField is the field that will be updated
-You can also use the below:
-- updateOne
-- findOneAndUpdate
Posted by: Guest on December-12-2020

Code answers related to "TypeScript"

Browse Popular Code Answers by Language