Details
-
Improvement
-
Resolution: Done
-
Major - P3
-
None
-
None
-
Ubuntu 13.04, 64-bit. MongoDB version 2.4.3.
*Location*: http://docs.mongodb.org/manual/reference/operator/exists/
*User-Agent*: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/28.0.1500.71 Chrome/28.0.1500.71 Safari/537.36
*Referrer*: https://www.google.com/
*Screen Resolution*: 1600 x 900
*repo*: docs
*source*: reference/operator/exists
Ubuntu 13.04, 64-bit. MongoDB version 2.4.3. *Location*: http://docs.mongodb.org/manual/reference/operator/exists/ *User-Agent*: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/28.0.1500.71 Chrome/28.0.1500.71 Safari/537.36 *Referrer*: https://www.google.com/ *Screen Resolution*: 1600 x 900 *repo*: docs *source*: reference/operator/exists
Description
In my installation of MongoDB 2.4.3, using $exists as part of an $elemMatch subquery returns elements with fields that exist but are null. This seems contrary to the behavior described in the documentation.
Here's the excerpt from my MongoDB session:
> db.rewards.findOne({ funds: { $elemMatch: { transactionHash: "915711f675abda802886039388f00feacbeaed843555fd173ca411d39bd30fa4", approved: {$exists: true}, }}})
{
"_availableFundAmounts" : [ ],
"_availableFundPayoutAmounts" : [ ],
"_expires" : ISODate("2013-11-26T22:02:12.012Z"),
"_id" : "5b76f2c5bbe1cb10ccc5ee4a",
"currency" : "btc",
"funds" : [
],
"issueUrl" : "https://github.com/codebounty/codebounty/issues/96",
"lastSync" : ISODate("2013-08-28T23:05:21.420Z"),
"log" : [ ],
"payout" : null,
"receivers" : [ ],
"status" : "open",
"userId" : "3bSKsLAhh4LyX4utR"
}