About 2 years ago (time is flying) I explained how I did the same to support range queries over "n" attributes, the method ended up being in the book "<i>MongoDB, the Definitive Guide</i>" by Chodorow and Dirolf (O'Reilly):<p><a href="http://chemeo.com/doc/technology" rel="nofollow">http://chemeo.com/doc/technology</a><p>(Search for "Indexing For High Speed Search" to skip non MongoDB related information).
What should be added to this is the ability to tell Mongo to return an error if your query requires a table scan. That one configuration item can be the difference between a request returning an error and a whole site going down for an extended period.