Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

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.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Update #multiple #documents #field #id #Mongoose
ADD COMMENT
Topic
Name
9+3 =