To select document by _id with Node.js node-mongodb-native, we call the update
method.
For instance, we write
const mongo = require("mongodb");
const id = new mongo.ObjectID(theId);
collection.update({ _id: id });
to create an object ID object with the ObjectID
constructor.
And then we call update
to update the document in the collection
with the id
_id
value.