[SERVER-3377] $elemMatch results not a subset of non $elemMatch results when there are missing values Created: 06/Jul/11  Updated: 29/Aug/11  Resolved: 29/Aug/11

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: Aaron Staple Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

> c.drop();
true
> c.save( {a:[

{b:1}

,{}]} )
> c.find(

{'a.b':null}

)
> c.find( {a:{$elemMatch:

{b:null}

}} )
{ "_id" : ObjectId("4e13d80b82517cd82873bc17"), "a" : [

{ "b" : 1 }

, { } ] }

Don't know if this is desired or not, thought I would check.

Also, the behavior is different from the above if the field missing 'b' is not an object:

> c.drop()
false
> c.save( {a:[

{b:1}

,'z']} )
> c.find(

{'a.b':null}

)
> c.find( {a:{$elemMatch:

{b:null}

}} )
>



 Comments   
Comment by Eliot Horowitz (Inactive) [ 29/Aug/11 ]

I think this is correct.

Generated at Thu Feb 08 03:02:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.