The answers above don't work for mongodb
6.
My workaround ;
import { ObjectId } from "mongodb";
const ids = ["6786b6789020e854f0099c0a", "6786b6789020e854f0099c0b"]
const userList = await db.collection("user")
.find({ _id: { $in: ids.map(_id => ObjectId.createFromHexString(_id)) } })
.toArray();