In MongoDB 3.2 they have give update multiple documents with one query like below
try {
db.inspectors.updateMany(
{ "inspector" : "J. Clouseau", "Sector" : 4 },
{ $set: { "Patrolling" : false } },
{ upsert: true }
);
}
catch (e) {
print(e);
}
I've checked php website for MongoDB for this query not having function for this.