when to index on multiple keys in mongodb

Posted by Evan on Stack Overflow See other posts from Stack Overflow or by Evan
Published on 2010-06-10T17:26:57Z Indexed on 2010/06/10 17:32 UTC
Read the original article Hit count: 179

Filed under:

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?

© Stack Overflow or respective owner

Related posts about mongodb