Question about Indexes

38 views
Skip to first unread message

Matthew Strickland

unread,
May 10, 2011, 5:18:24 PM5/10/11
to mongodb-user
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

a
a,b
a,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?

Scott Hernandez

unread,
May 10, 2011, 5:34:21 PM5/10/11
to mongod...@googlegroups.com
Not efficiently, no. Take a look at the explain() from queries to see what happens.
 

--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.


Reply all
Reply to author
Forward
0 new messages