I have a large mongo collection, when I run {"$and":[{"fieldCheck":"1"},{"timestamp":{"$lt": MAX_SAFE_INTEGER}}]}
, the query results the output fast, but when i sort by {timestamp: -1, _id: -1}
with the previous filters then the query takes forever.
The collection is indexed with composite index {timestamp: 1, _id: 1}
, also fieldCheck
is indexed with _id
{fieldCheck: 1, _id: 1}
Whats wrong is going on?
I tried indexing mentioned.