MongoDB Documentation, Release 3.0.4 The sort must specify the same sort direction (i.e.ascending/descending) for all its keys as the index key pattern or specify the reverse sort direction for all its keys as the index key pattern. For example, an index key pattern { a: 1, b: 1 } can support a sort on { a: 1, b: 1 } and { a: -1, b: -1 } but not on { a: -1, b: 1 } . Sort and Index Prefix If the sort keys correspond to the index keys or an index prefix , MongoDB can use the index to sort the query results. A prefix of a compound index is a subset that consists of one or more keys at the start of the index key pattern. For example, create a compound index on the data collection: db.data.createIndex( { a:1, b: 1, c: 1, d: 1 } ) Then, the following are prefixes for that index: The following query and sort operations use the index prefixes to sort the results. These operations do not need to sort the result set in memory. { a: 1 } { a: 1, b: 1 } { a: 1, b: 1, c: 1 } Consider the following example in which the prefix keys of the index appear in both the query predicate and the sort: db.data.find( { a: { $gt: 4 } } ).sort( { a: 1, b: 1 } ) In such cases, MongoDB can use the index to retrieve the documents in order specified by the sort. As the example shows, the index prefix in the query predicate can be different from the prefix in the sort. Sort and Non-prefix Subset of an Index An index can support sort operations on a non-prefix subset of the index key pattern. To do so, the query must include equality conditions on all the prefix keys that precede the sort keys. For example, the collection data has the following index: { a: 1, b: 1, c: 1, d: 1 } The following operations can use the index to get the sort order: As the last operation shows, only the index fields preceding the sort subset must have the equality conditions in the query document; the other index fields may specify other conditions. 549 8.3. Indexing Tutorials Example Index Prefix db.data.find().sort( { a: 1 } ) { a: 1 } db.data.find().sort( { a: -1 } ) { a: 1 } db.data.find().sort( { a: 1, b: 1 } ) { a: 1, b: 1 } db.data.find().sort( { a: -1, b: -1 } ) { a: 1, b: 1 } db.data.find().sort( { a: 1, b: 1, c: 1 } ) { a: 1, b: 1, c: 1 } db.data.find( { a: { $gt: 4 } } ).sort( { a: 1, b: 1 } ) { a: 1, b: 1 } Example Index Prefix db.data.find( { a: 5 } ).sort( { b: 1, c: 1 } ) { a: 1 , b: 1, c: 1 } db.data.find( { b: 3, a: 4 } ).sort( { c: 1 } ) { a: 1, b: 1, c: 1 } db.data.find( { a: 5, b: { $lt: 3} } ).sort( { b: 1 } ) { a: 1, b: 1 }