Created
April 17, 2012 00:56
-
-
Save crystalneth/2402651 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
// Can't get $and working | |
// This is Mongo 2.0.4 | |
``` | |
> db.foo.insert({letter: 'a', number: 2}) | |
> db.foo.find() | |
{ "_id" : ObjectId("4f8cbf5b19a4296c4255028e"), "letter" : "a", "number" : 2 } | |
> db.foo.find({letter: 'a'}) | |
{ "_id" : ObjectId("4f8cbf5b19a4296c4255028e"), "letter" : "a", "number" : 2 } | |
> db.foo.find({letter: 'a', number: 2}) | |
{ "_id" : ObjectId("4f8cbf5b19a4296c4255028e"), "letter" : "a", "number" : 2 } | |
// WHY DON"T ANY OF THESE RETURN RECORDS? | |
> db.foo.find({$and: [{letter: 'a', number: 2}]}) | |
> db.foo.find({$and: [{letter: 'a'}, {number: 2}]}) | |
> db.foo.find({$and: [{letter: 'a'}]}) | |
> db.foo.find({$and: []}) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment