[SERVER-72403] $elemMatch should check for strict object type when matching sub-object Created: 27/Dec/22 Updated: 27/Oct/23 Resolved: 28/Dec/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Arun Banala | Assignee: | Backlog - Query Execution |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query Execution
|
| Operating System: | ALL |
| Participants: |
| Description |
|
The code in ElemMatchObjectMatchExpression::matchesArray() is not checking for strict object type for sub-objects. This means the _sub match expression could incorrectly be applied on a sub-array and match wrong documents in some cases. We should change the above condition to inner.type() == Object instead. |
| Comments |
| Comment by Arun Banala [ 28/Dec/22 ] |
|
Actually, this is probably Works as designed. The '0' can be treated as both field name or array index. |