Created
January 29, 2011 04:06
-
-
Save clizzin/801515 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> db.foo.insert({a: {john: true, george: true}}) | |
> db.foo.insert({a: {paul: true, ringo: true}}) | |
> db.foo.find() | |
{ "_id" : ObjectId("4d43912ceb913a1024b1410f"), "a" : { "john" : true, "george" : true } } | |
{ "_id" : ObjectId("4d43914beb913a1024b14110"), "a" : { "paul" : true, "ringo" : true } } | |
> db.foo.find({'a.john': {$exists: true}}) | |
{ "_id" : ObjectId("4d43912ceb913a1024b1410f"), "a" : { "john" : true, "george" : true } } | |
> db.foo.find({'a.paul': {$exists: true}}) | |
{ "_id" : ObjectId("4d43914beb913a1024b14110"), "a" : { "paul" : true, "ringo" : true } } | |
> db.foo.find({$or: [{'a.john': {$exists: true}}, {'a.paul': {$exists: true}}]}) | |
> | |
> db.foo.stats() | |
{ | |
"ns" : "topher_test.foo", | |
"count" : 2, | |
"size" : 96, | |
"storageSize" : 2816, | |
"numExtents" : 1, | |
"nindexes" : 1, | |
"lastExtentSize" : 2816, | |
"paddingFactor" : 1, | |
"flags" : 1, | |
"totalIndexSize" : 8192, | |
"indexSizes" : { | |
"_id_" : 8192 | |
}, | |
"ok" : 1 | |
} |
scotthernandez
commented
Jan 29, 2011
Turns out the issue with $or not working is that I was using an old version released prior to the introduction of $or.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment