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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With