[SERVER-36254] No index support for filtering on array fields inside $expr operator Created: 24/Jul/18 Updated: 04/Sep/18 Resolved: 25/Jul/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | 3.6.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Cezary Bartosiak | Assignee: | Nick Brewer |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
I have a collection containing the following documents:
The index below is defined:
I'm testing an aggregation with a single $match stage:
It returns the second document as expected, but without index support:
I discovered this strange behavior when testing a $lookup stage with an internal pipeline, where $expr operator is a must. BTW - I'm aware of this issue. I have tested non-array fields and indeed indexes are used for them. |
| Comments |
| Comment by Cezary Bartosiak [ 25/Jul/18 ] |
|
Thank you for the clarification. I will vote then... |
| Comment by Nick Brewer [ 24/Jul/18 ] |
|
cbartosiak I believe what you're encountering is similar to what's documented in this ticket: SERVER-32549. The issue you linked to demonstrates that work was put into allowing index usage with $elem and equality matching - however as you've demonstrated this is still not the case with $in. You can vote for that ticket if this is an important feature for you, and follow along with it for updates. -Nick |
| Comment by Cezary Bartosiak [ 24/Jul/18 ] |
|
The link is gone. I mentioned this issue: https://jira.mongodb.org/browse/SERVER-31760 |