I have a script that identified two records that I need to update. My query returned the two _id values as: 62bdca65a69a2cdf17978992 and 62c06c18d694a13c4a29c078. I generated update the statements:
db.people.updateOne({_id: ObjectId('62bdca65a69a2cdf17978992')}, {$set: {dept: 22}});
db.people.updateOne({_id: ObjectId('62c06c18d694a13c4a29c078')}, {$set: {dept: 22}});
Only one got updated and examination of the data showed that one has the _id: 62bdca65a69a2cdf17978992 and the other has the _id as ObjectId('62c06c18d694a13c4a29c078').