db.cities.createIndex( { elevation: -1 } );
db.cities.find( { population: { $gte: 2000000 }, elevation: { $gte : 1654 } } )
.sort( { elevation: -1 } ).explain();
"winningPlan" : {
*"stage" : "SORT",*
"sortPattern" : { "elevation" : -1 },
"inputStage" : {
"stage" : "SORT_KEY_GENERATOR",
"inputStage" : {
"stage" : "FETCH",
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : { "population" : 1, "elevation" : 1 },
}
}
}
},