[SERVER-958] Range queries on arrays behave differently with indexes Created: 04/Apr/10 Updated: 12/Jul/16 Resolved: 16/May/11 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | 1.9.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Mathias Stearn | Assignee: | Aaron Staple |
| Resolution: | Done | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
> db.test.insert( {a:[1,10]}) > db.test.ensureIndex( {a:1}) |
| Comments |
| Comment by Aaron Staple [ 16/May/11 ] |
|
A few related todos |
| Comment by auto [ 02/May/11 ] |
|
Author: {u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}Message: |
| Comment by auto [ 02/May/11 ] |
|
Author: {u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}Message: |
| Comment by auto [ 25/Apr/11 ] |
|
Author: {u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}Message: |
| Comment by auto [ 25/Apr/11 ] |
|
Author: {u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}Message: |
| Comment by auto [ 25/Apr/11 ] |
|
Author: {u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}Message: |
| Comment by auto [ 25/Apr/11 ] |
|
Author: {u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}Message: |
| Comment by auto [ 25/Apr/11 ] |
|
Author: {u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}Message: |
| Comment by auto [ 25/Apr/11 ] |
|
Author: {u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}Message: |
| Comment by Eliot Horowitz (Inactive) [ 12/Oct/10 ] |
|
Yes and Yes. |
| Comment by Aaron Staple [ 12/Oct/10 ] |
|
If you want that to be the correct solution, then I don't think we'll ever be able to do a closed range index search on an index where multikeys are used. In the above example, we'd need to scan the index either for all documents where a < 5 or all documents where a > 2. Also, how should I pick which of those ranges to scan? Just use the first one? |
| Comment by Eliot Horowitz (Inactive) [ 12/Oct/10 ] |
|
Without the index is correct. |
| Comment by Aaron Staple [ 12/Oct/10 ] |
|
Ok - which is the correct result? The one with the index or without? |
| Comment by Jerry [ 03/Oct/10 ] |
|
Nevermind on my last comment. |
| Comment by Jerry [ 03/Oct/10 ] |
|
The possible workaround thus far: > db.test.find({a:{$lt:5, $not:{$gte:2}}}) I believe the technical term for this is "hax!" |