Update by ObjectId

Like mentioned

There is no problem with the quotes. In fact the quotes are required with the dot notation.

mongosh> db.devices.find()


{ _id: ObjectId("6427f848b39a9135e7b7e63e"), value: 'initial' }


mongosh> db.devices.updateOne({"_id": ObjectId("6427f848b39a9135e7b7e63e")}, {"$set" :{"value": "on"}})

{ acknowledged: true,
  insertedId: null,
  matchedCount: 1,
  modifiedCount: 1,
  upsertedCount: 0 }

mongosh> db.devices.find()

{ _id: ObjectId("6427f848b39a9135e7b7e63e"), value: 'on' }