Support Query Hinting by Index Name in the Mongo shell, as addressed in
I noticed an old ticket (
SERVER-8) about removing index names as redundant. I don't know if that's still intended, and I do appreciate the necessity of simplicity. At the same time, I want to defend index names as an important means of hiding implementation details.
Sure, developers "should" normally know the structure of the indices they're using. However, in some cases we might just be using an index to ensure quick sorting on an abstract property, regardless of which document fields that property happens to cover. Query hints are a key area to realize the value of index names, because symbolic names can allow developers to vary index definition in response to "schema" adjustments (albeit Mongo is NoSQL, we still have pseudo-schemas) without impacting the optimization of downstream queries. And, given that field names are often optimized to a fine point just to reduce storage size (see
SERVER-863), the field structure of an index tends to be far less meaningful than its name.
Indices are the pith of queries, and index names are the closest Mongo has to named views. Let's take them to the next level and allow hinting on index names!