[SERVER-18959] Cannot use comparaison operator to query ObjectID in embedded documents Created: 12/Jun/15 Updated: 30/Sep/15 Resolved: 13/Jun/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 3.0.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Sylvain Leroux [X] | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
|||||||||||||||||||
| Operating System: | ALL | |||||||||||||||||||
| Steps To Reproduce: | Given that collection:
$eq comparison on ObjectID works for the root document:
But not for the embedded document:
Please note that using the dot notation to access the inner field, the query works:
|
|||||||||||||||||||
| Participants: | ||||||||||||||||||||
| Description |
|
You cannot use the relational operators $eq or $in to query ObjectID in an embedded document. All is like is, for embedded documents, comparison was performed using ==, whereas for root document, it uses equals. |
| Comments |
| Comment by Sylvain Leroux [X] [ 13/Jun/15 ] |
|
I fell so stupid. When you perform an equality match on embedded document, using the query { field: <value> }, value is a document to match. Not a query document. This is a non-issue, and should be closed. |