Skip to content

Instantly share code, notes, and snippets.

@mediocregopher
Created October 29, 2012 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mediocregopher/3976423 to your computer and use it in GitHub Desktop.
Save mediocregopher/3976423 to your computer and use it in GitHub Desktop.
Index:
{
"v" : 1,
"key" : {
"arid" : 1,
"_id" : -1
},
"ns" : "feeds.artistEvents",
"name" : "arid_1__id_-1",
"background" : true
},
Uses the index:
db.artistEvents.find({ arid: 1239926 }).sort({ _id: -1 }).explain()
Doesn't use the index:
db.artistEvents.find({ $query: { arid: 1239926 }, $orderby: { _id: -1 } }).explain()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment