[DOCS-6233] We should clarify that range queries on non-array fields do not work with multi-key indexes Created: 18/Sep/15 Updated: 21/Sep/17 Resolved: 17/Jul/17 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Dmitry Ryabtsev | Assignee: | Kay Kim (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Participants: | |||||||||||||
| Days since reply: | 6 years, 30 weeks, 2 days ago | ||||||||||||
| Description |
|
This page: http://docs.mongodb.org/master/core/multikey-index-bounds/ It should mention the following limitation. If there is a compound multi-key index including a non-array field, then if this field is queried (and even if it's a leading field in the index and if queried alone with no array field) then MongoDB will not be able to intersect the bounds properly. And $elemMatch will not help because it is designed to work with array fields only. The only workaround is to create a non-multi key index on the non-array field and use that for the range queries. The situation is explained in detail in |
| Comments |
| Comment by Githook User [ 17/Jul/17 ] |
|
Author: {u'username': u'kay-kim', u'name': u'kay', u'email': u'kay.kim@10gen.com'}Message: |
| Comment by Githook User [ 17/Jul/17 ] |
|
Author: {u'username': u'kay-kim', u'name': u'kay', u'email': u'kay.kim@10gen.com'}Message: |
| Comment by Kelsey Schubert [ 12/Jul/17 ] |
|
Yes, that's right. |
| Comment by Dmitry Ryabtsev [ 12/Jul/17 ] |
|
anonymous.user, as far as I can tell
And Or am I missing something? |
| Comment by Kelsey Schubert [ 14/Nov/16 ] |
|
Note that this is no longer the case in MongoDB 3.4: |