[SERVER-11517] Mongo index on implicit/explicit $and not consistent Created: 01/Nov/13 Updated: 11/Jul/16 Resolved: 01/Nov/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 2.4.6 |
| Fix Version/s: | 2.5.3 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | George Narroway | Assignee: | hari.khalsa@10gen.com |
| Resolution: | Done | Votes: | 0 |
| Labels: | query_triage | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 64bit, 2.4.6. |
||
| Attachments: |
|
|||||||||||
| Operating System: | ALL | |||||||||||
| Steps To Reproduce: |
|
|||||||||||
| Participants: |
| Description |
|
Mongo allegedly uses an implicit AND when quering comma-separated fields of the form:
Thus the above should be equivalent in all senses to:
However, including the explicit $and alters the indexing behaviour of the search. Using the below steps, the explicit $and uses only the _id index, whereas the implicit $and utilises other indexes. Trying to force the explicit $and to use the index that the implicit version is using (with .hint()) does not work. |
| Comments |
| Comment by Benety Goh [ 01/Nov/13 ] |
|
This behavior is now consistent as a result of the recent query framework enhancements. |