Answers for "how to update all records in mongodb"

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
0

mongodb update all items in array

// If array field not in find, use $[]
db.products.updateMany({}, {
  $set:{ "variants.$[]._id": new ObjectId() }
})
Posted by: Guest on January-17-2022

Code answers related to "how to update all records in mongodb"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language