[SERVER-16256] $all clause with elemMatch uses wider bounds than needed Created: 20/Nov/14 Updated: 29/Dec/17 Resolved: 01/Dec/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 2.6.5 |
| Fix Version/s: | 2.6.10, 2.8.0-rc2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Anil Kumar | Assignee: | David Storch |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||
| Backport Completed: | |||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||
| Description |
|
When using $all with $elemMatch criteria, the query uses wider bounds than what it should have used (v2.4 behaves correctly in selecting narrow bounds). Following are steps indicates the wider bounds being queried on the array field "bc":
Explain with $all:
|
| Comments |
| Comment by Githook User [ 10/Apr/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}Message: Every $all should parse to an AND match expression. This simplifies the (cherry picked from commit 430f62da7380a6864058c2f75a64c5d662a95176) Conflicts: | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 01/Dec/14 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}Message: Every $all should parse to an AND match expression. This simplifies the | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by David Storch [ 20/Nov/14 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Simpler repro:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Anil Kumar [ 20/Nov/14 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Using an alternate for with "$and" uses the appropriate narrow bound selection:
Explain Plan with $and:
|