Q: NodeJS MongoDb updateMany() with a condition? I want to update a MongoDb collection with an Array of JSON objects.
However, I want the update to ignore any objects that already exist in the DB.
Sounds easy, but the key that allows me to know if the object exists is not the '_id', but a different 'id' (or other key).
Is that possible ?
Currently I am using it like this:
dbHandle.collection('contents').updateMany(contents);

where 'contents' is the Array of JSON objects.
Thanks in advance

A: The following operation updates all documents where violations are greater than 4 and $set a flag for review:
try {
   db.restaurant.updateMany(
      { violations: { $gt: 4 } },  //Your Condition
      { $set: { "Review" : true } }  //YOUR JSON contents
   ); 
} catch (e) {
   print(e);
}

Change the condition accordingly.
