Skip to content

Instantly share code, notes, and snippets.

@scotthernandez
Created October 13, 2010 00:26
Show Gist options
  • Save scotthernandez/623176 to your computer and use it in GitHub Desktop.
Save scotthernandez/623176 to your computer and use it in GitHub Desktop.
> db.test0.find({v:{$all:[1,2]}})
{ "_id" : 2, "v" : [ 1, 2, 3 ] }
> db.test0.find({v:{$all:[1,2]}}).explain()
{
"cursor" : "BasicCursor",
"nscanned" : 3,
"nscannedObjects" : 3,
"n" : 1,
"millis" : 37,
"nYields" : 0,
"nChunkSkips" : 0,
"indexBounds" : {
}
}
> db.test0.ensureIndex({v:1})
> db.test0.find({v:{$all:[1,2]}}).explain()
{
"cursor" : "BtreeCursor v_1",
"nscanned" : 1,
"nscannedObjects" : 1,
"n" : 1,
"millis" : 0,
"nYields" : 0,
"nChunkSkips" : 0,
"indexBounds" : {
"v" : [
[
1,
1
]
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment