Q:

MongoDb Range Query on ObjectId

I had like to know if somebody knows if it is possible to query the _id field with a
query like this : 
{$lte : ObjectId(....) , $gte : ObjectId(...)

, instead of 
{$in : [ObjectId( )...lots of ObjectId.....]}

and if there is a gain in performance (i think so..)
Thanks

A:

{$lte : ObjectId(....) , $gte : ObjectId(...)

Yes there is such query {_id : {$lte : ObjectId(....) , $gte : ObjectId(...)} }
The performance depends on what is the range that you have selected in 1st query.  Smaller range means fast response.  For 2nd query, response depends on count and range of ObjectIds in the query.  The more fragmentation in the value of ObjectIds may incur large no of page faults.