I have a following situation:
- I have a collection with documents like
{a: 1, b: 'some string', c: 5, d: 7 } {a: 2, b: 'some another string', c: 5, d: 8 } {a: 3, b: 'yet another string', c: 5, d: 9 }
- I allow users to search using custom queries, so sometimes I can search for:
{a: 2, c:5} {c:5, d:8}
- Some of the used fields are mandatory (eg. c)
- I thought about seting up indexes for c so queries would work faster, and when I do:
db.my_collection.find({c:5})
it works great, but when I launch:
db.my_collection.find({c:5,d:8})
it consumes the same ommount of time when withought an index :(
So my question is: Is it possible to set up some kind of partial index so queries would in first place search inside keys that have indexes, and than inside those withought them?