[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: PNG File image-2018-07-24-17-12-31-999.png     PNG File image-2018-07-24-17-13-14-601.png     PNG File image-2018-07-24-17-22-03-862.png     PNG File image-2018-07-24-17-23-28-706.png    
Issue Links:
Duplicate
duplicates SERVER-32549 allow $expr with $in expression use a... Backlog
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

Generated at Thu Feb 08 04:42:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.