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

The solution for “Update multiple documents with different field value by id set. Mongoose” can be found here. The following code will assist you in solving the problem.

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.

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in