I've read the chapter on indexes in the MongoDB in action book and was wondering if anyone can expand upon what it talks about regarding indexes.
If I have an index that covers a,b,c,d,e
and I query on a,b,c
the index is used. What happens if I query on a,c,e
? Is the index just used for the query on a
or does it get used when querying on the other fields?
In this case does it make more sense to also have the index on a,c,e
. I ask because I have a front end piece that links to these fields where users can create a free form query (a,b,c,f
could be one). Do I need an index for all possible options that could come through?