[SERVER-10030] Empty parent returned where projection key doesn't exist Created: 26/Jun/13 Updated: 10/Dec/14 Resolved: 13/Aug/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Matt Campbell | Assignee: | Stennie Steneker (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Operating System: | ALL |
| Steps To Reproduce: | // Returns immediate parent which exists }}) ) // Returns 2 parents up which exists ) It should be noted that if there was a projection for keys within the respective docs returned they would be showed. However, I'm not sure why an empty sub doc is returned when no other projections are made for it. Is this an intended design or a bug? |
| Participants: |
| Description |
|
When using dot notation to construct a projection on sub document keys, if the key specified in the project doesn't exist it returns the next ancestor which does exist, but as an empty document. |
| Comments |
| Comment by Stennie Steneker (Inactive) [ 13/Aug/13 ] | |
|
Hi Matt, This is the expected outcome given your query and projection. If you wanted to get nil results you can use $exists in the criteria so you only match documents where that key exists:
Regards, |