[SERVER-9092] Allow for Binary prefixes, and more broadly, ranges in general, to be used as parts of $in queries. Created: 22/Mar/13 Updated: 25/Jun/15 Resolved: 15/Jun/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Osmar Olivo | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Participants: | |||||||||||||
| Description |
|
Generally speaking, allowing for $in queries to be able to handle a richer level of query power such as ranges would be immensely helpful. Otherwise in some cases where $in should be applicable, you are forced to use $or and hence forced to pay a performance cost. Something like the below would be what would be nice where a new query operator for that field, would also be accepted.
The above should return all values of a that are between 5-10 or between 20-30. |
| Comments |
| Comment by J Rassi [ 15/Jun/15 ] | ||
|
The query from the ticket description can currently be expressed with the $or operator. See also linked ticket SERVER-12024. Note that when implementing SERVER-12024, we will consider adding additional optimizations for such $or queries. I'm closing this ticket as "Won't Fix". ~ Jason Rassi | ||
| Comment by Yuri Finkelstein [ 03/Jul/13 ] | ||
|
What's described in my example is not supported. The current version supports $gt and $lt only in the context of a single constraint term, while the request is support multiple terms in a single query. The only way to compose a multi-term query today is with $or. But this is very inefficient compared to $in. This is not at all about the syntax. The example is simply an illustration of how it might look. | ||
| Comment by Asya Kamsky [ 03/Jul/13 ] | ||
|
This already works in the current version - specifically using {$gt: , $lt: } syntax. Is this request specifically for different syntax than is currently required? Currently you can use the same syntax as shown with Bin types. Property index boundaries will be used, and covered index queries work already. $limit functionality on each "branch" is a new feature request and I believe it's already a separate jira ticket. EDIT I think this ticket is specifically for making it work with $in (since it already works with $or) if so then never mind my comment. | ||
| Comment by Yuri Finkelstein [ 23/Mar/13 ] | ||
|
This feature is specifically about ability to perform prefix search on <b>indexed Binary</b> field, and the example given in the description does not fully reflect the motive. I'm proposing 2 ways to express this, just to illustrate what is the goal of this feature. In both cases the goal is to lookup N prefixes in indexed binary field stored as _id and limit the number of matches on each prefix. The first example allows specification of the limit per each term while the second one specifies the limit on the entire $in clause.
Perhaps the description of this ticket can be modified to reflect these examples. Thanks, |