How to select where in array of _id with JavaScript MongoDB?

To select where in array of _id with JavaScript MongoDB, we use the $in operator.

For instance, we write

db.collection.find({ _id: { $in: [1, 2, 3, 4] } });

to call find with the $in operator to return the entries with _id 1, 2, 3, and 4 with find in the collection collection.