Update by ObjectId

I am a MongoDB newbie and the examples I am seeing is using other fields as a filter but I want to update using the ObjectId
How do you update by ObjectId in mongosh?
I tried
db.devices.updateOne({"_id": ObjectId("6427f848b39a9135e7b7e63e")}, {"$set" :{"value": "on"}})

but no rows were updated.

What should be the correct query in this case?

The code is good.

You might be connected on the wrong server.

You might be using the wrong database.

You might be using the wrong collection.

You might be using a non-existing _id on the correct collection of the correct database on the correct server.