when to index on multiple keys in mongodb
- by Evan
say I have an Item document with :price and :qty fields. I sometimes want to find all documents matching a given :price AND :qty, and at other times it will be either :price on its own or :qty on its own.
I have already indexed the :price and :qty keys, but do I also need to create a compound index on both together or are the single key indexes enough?