|
Inspired by https://groups.google.com/forum/#!topic/mongodb-user/zSRygrd5GP0, I'd like to add more detail to http://docs.mongodb.org/manual/core/index-text/#compound-index to include a warning that a text index with following index keys, like
{ "t" : "text", "a" : 1 }
|
does not provide the ability to sort on the following field using the compound index. For example, the following query uses the text index but is scanAndOrder = true
db.test.find({ "$text" : { "$search" : "cookies" } }).sort({ "a" : 1 })
|
The only indexed sort available is on strength of text match. I've seen a couple of questions where people express surprise at this limitation so I think it'd be nice to document it.
|