[SERVER-42277] MongoDB ignores some hint'ed queries on array fiels (e.g., array: {$gt: [10]}) in v2.2.3 Created: 18/Jul/19 Updated: 06/Dec/22 Resolved: 22/Jul/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | João Agnelo | Assignee: | Backlog - Triage Team |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Server Triage
|
| Operating System: | ALL |
| Participants: |
| Description |
|
While performing an academic experiment based on the random generation of a large set of tests to exercise the Query Language of MongoDB (all of which syntactically valid), a possible bug was detected in some preliminary trial tests. Comparing an array field to an array of values (e.g., {$gt: ["a", "b"] or ["a"]}) instead of a single value (e.g., "a" or "b") on a hint()'ed query returns erroneous results.
Examples: find($and: [{array: {$gt: [10]}}, {notArray: {$lt: 1000}}]) results in the same as find({notArray: {$lt: 1000}}) meaning that the array portion of the query is ignored ------------------------------------------------------------------------------------------- ensureIndex({notArray: 1}) find($and: [{array: {$gt: [10]}}, {notArray: {$lt: 1000}}]) no results and cursor.count() and cursor.size() both return 0 find($and: [{array: {$gt: [10]}}, {notArray: {$lt: 1000}}]).hint("id") shows results in the shell but cursor.count() and cursor.size() both return 0 find($and: [{array: {$gt: [10]}}, {notArray: {$lt: 1000}}]).hint("notArray_1") no results and cursor.count() and cursor.size() both return 0
|
| Comments |
| Comment by Danny Hatcher (Inactive) [ 22/Jul/19 ] |
|
Due to the old age of this version of MongoDB, I'm going to close this ticket. Please re-open if you are able to reproduce against a modern version. |