Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
// First query. Notice n = 6758. The second OR condition by definition includes the first.
> db.contacts.find(
... {
...
... $or: [
... {'foo': 32}
... ,{'foo': 32, 'bar' : 151629}
... ]
... }
... ).explain();
{
"cursor" : "BtreeCursor foo_1_bar_1",
"nscanned" : 6758,
"nscannedObjects" : 6758,
"n" : 6758,
"millis" : 7,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : false,
"indexOnly" : false,
"indexBounds" : {
"foo" : [
[
32,
32
]
],
"bar" : [
[
{
"$minElement" : 1
},
{
"$maxElement" : 1
}
]
]
}
}
// Second query. Notice n = 6761.
> db.contacts.find(
... {
...
... $or: [
... {'foo': 32, 'bar' : 151629},
... {'foo': 32}
... ]
... }
... ).explain();
{
"clauses" : [
{
"cursor" : "BtreeCursor foo_1_bar_1",
"nscanned" : 3,
"nscannedObjects" : 3,
"n" : 3,
"millis" : 0,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : false,
"indexOnly" : false,
"indexBounds" : {
"foo" : [
[
32,
32
]
],
"bar" : [
[
151629,
151629
]
]
}
},
{
"cursor" : "BtreeCursor foo_1_bar_1",
"nscanned" : 6758,
"nscannedObjects" : 6758,
"n" : 6755,
"millis" : 33,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : false,
"indexOnly" : false,
"indexBounds" : {
"foo" : [
[
32,
32
]
],
"bar" : [
[
{
"$minElement" : 1
},
{
"$maxElement" : 1
}
]
]
}
}
],
"nscanned" : 6761,
"nscannedObjects" : 6761,
"n" : 6758,
"millis" : 33
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.