We're having an issue where the Count and Sort operations drag the aggregate hundreds of times longer than just returning the documents.
We can get the documents for a page back in 200ms or less using a rigged countQuery, but once we drop our .limit() on the countQuery our execution times jump to 60seconds, then if we add a sort, on an indexed field (both in our Search Index and indexed separately) it can take 120+seconds.
Every field we're querying on is indexed. Obiously it's scanning the entire collection in these cases but I can't crack this
We're having an issue where the Count and Sort operations drag the aggregate hundreds of times longer than just returning the documents.
We can get the documents for a page back in 200ms or less using a rigged countQuery, but once we drop our .limit() on the countQuery our execution times jump to 60seconds, then if we add a sort, on an indexed field (both in our Search Index and indexed separately) it can take 120+seconds.
Every field we're querying on is indexed. Obiously it's scanning the entire collection in these cases but I can't crack this