I have this index a,b,-c on a Mongo collection.
When I run this query: find by a,b,f,(sort by) -c, will the index on c make sorting fast?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, the compound index on those fields will make the following queries fast:
As long as the sort order is the same sort order as in the index, that is. If you reverse the sort order on any of those three keys, Mongo will do a full collection scan rather than using than using the index.