When i use System.linq to query objects in a MongoCollection:
var result = collection.Find(query).Where(x => x.something == something);
is this a query done on the database or on the collection in memory?
for instance "SetSkip" creates the query in MongoDb but "Skip" does it in memory.
If ".Where" is done in memory is there a way not to do this?
The
.Where
query is done in memory viaIEnumerable.Where
because it's performed on the result of theFind
call that establishes the MongoDB query to perform.To incorporate the
.Where
query into theFind
, you can create a new query that ANDs the two queries together: