[SERVER-14770] warn when more than one array is used in a query with $ projection operator Created: 01/Aug/14 Updated: 02/Aug/14 Resolved: 02/Aug/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | William Cross | Assignee: | hari.khalsa@10gen.com |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Participants: | |||||||||
| Description |
|
When you query for a value on each of two arrays, both with positional operators, the $ projection operator can get pretty confused but smoothly performs the wrong operation. Steps to reproduce: Perform the following operations in the shell:
Expected result: { "a" : 7 }or an exception Actual result : { "a" : 5 }Related documentation: The following doc tells me not to do exactly what I did: http://docs.mongodb.org/manual/reference/operator/projection/positional/#proj._S_ "Only one array field can appear in the query document; i.e. the following query is incorrect:" (then the example shows me exactly what I did), but this is clearly a case where either an exception should be thrown, or else the $ operator should be made smarter. |
| Comments |
| Comment by Scott Hernandez (Inactive) [ 02/Aug/14 ] | |
|
dup of | |
| Comment by Ramon Fernandez Marina [ 01/Aug/14 ] | |
|
According to the documentation, only one array can appear on the query document, so
is incorrect if both a and b are arrays. | |
| Comment by William Cross [ 01/Aug/14 ] | |
|
By the way, the following query happily throws an exception:
|