I know MongoDB is able to handle a lot of requests/sec, but let\'s say I have to query a lot of documents of a collection given their _id; what sounds better: making a $in o
I would definitely go with using the $in query and providing a array of _ids.
Example:
db.collection.find({
"key": {
"$in": [
ObjectId("xxx"),
ObjectId("yyy"),
ObjectId("zzz")
]
}
})
Why?
There's some additional documentation here if you want to check it out.