Suppose you have a list of id-s which can contain up to thousands id-s for the documents inside the database. What is the best way to get those documents back?
Should I invoke a query for each of them or should I specify a giant OR query? may be there is something way better I do not know of
In c# code, $in:
var ids = new int[] {1, 2, 3, 4, 5};
var query = Query.In("name", BsonArray.Create(ids));
var items = collection.Find(query);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With