简体   繁体   中英

MongoDB Indexes

The documentation says: If you have a compound index on multiple fields, you can use it to query on the beginning subset of fields. So if you have an index on a,b,c you can use it query on aa,ba,b,c

My question is, if I have a compound index like a,b,c can I query on a,c and sort on c?

It looks like this question was answered on the Google Groups :

Not efficiently, no. Take a look at the explain() from queries to see what happens.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM