Answers for "update multiple records mongoose"

0

Update multiple documents by id set. Mongoose

Element.update(
   { _id: { $in: ['id1', 'id2', 'id3'] } },
   { $set: { visibility : yourvisibility } },
   {multi: true}
)
Posted by: Guest on September-15-2021
-1

Update multiple documents with different field value by id set. Mongoose

You can not update two documents at once with a MongoDB query. You will always have to do that in two queries. You can of course set a value of a field to the same value, or increment with the same number, but you can not do two distinct updates in MongoDB with the same query.
Posted by: Guest on May-13-2021

Code answers related to "update multiple records mongoose"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language