[SERVER-1264] $elemMatch on subArray Created: 21/Jun/10 Updated: 26/Feb/19 Resolved: 12/Feb/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 1.5.2 |
| Fix Version/s: | 2.6.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Andrea Fontana | Assignee: | Kelsey Schubert |
| Resolution: | Done | Votes: | 12 |
| Labels: | query_triage, todo_in_code | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Backwards Compatibility: | Minor Change | ||||||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||
| Description |
|
Here a test-case:
These two commands should find this element but they don't:
|
| Comments |
| Comment by Ramon Fernandez Marina [ 12/Feb/18 ] | |||||||||||||
|
This was fixed back in 2.6, but closing the ticket fell through the cracks. | |||||||||||||
| Comment by Thomas Zahn [ 14/Feb/14 ] | |||||||||||||
|
As a consequence, this unfortunately also affects the work-around to detect instances where a field a is an array, as suggested in
It won't work for nested arrays.
Suppose one now wanted to explicitly find those documents where a specific element of a (e.g. a.0) is again an array, i.e. a 2-dimensional array. Unfortunately, only $size seems to work on a.0, whereas $elemMatch fails:
| |||||||||||||
| Comment by auto [ 09/Jun/12 ] | |||||||||||||
|
Author: {u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}Message: | |||||||||||||
| Comment by auto [ 09/Jun/12 ] | |||||||||||||
|
Author: {u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}Message: | |||||||||||||
| Comment by Aaron Staple [ 05/Apr/12 ] | |||||||||||||
|
Robert identified some additional todos for supporting the full range of mongo query operators inside $elemMatch. He described them in SERVER-5506. | |||||||||||||
| Comment by auto [ 13/Sep/11 ] | |||||||||||||
|
Author: {u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}Message: | |||||||||||||
| Comment by auto [ 15/Nov/10 ] | |||||||||||||
|
Author: {'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}Message: notes for | |||||||||||||
| Comment by Piotr Beling [ 24/Sep/10 ] | |||||||||||||
|
I understand. Thanks! | |||||||||||||
| Comment by Eliot Horowitz (Inactive) [ 24/Sep/10 ] | |||||||||||||
|
No - we won't backport this. | |||||||||||||
| Comment by Piotr Beling [ 24/Sep/10 ] | |||||||||||||
|
Can I ask for back-port fixes to 1.6 brunch? I think that this is typical bug and it is good idea to back-port it to stable brunch. | |||||||||||||
| Comment by auto [ 24/Sep/10 ] | |||||||||||||
|
Author: {'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}Message: $elemMatch works on primitives | |||||||||||||
| Comment by Eliot Horowitz (Inactive) [ 25/Aug/10 ] | |||||||||||||
|
db.foo.save( {a:[1, 2, 6]}) ) > db.foo.find( {a:{$elemMatch:{$gte:3, $lte: 5}}} ) |