[SERVER-25235] Views should drop 'singleBatch' if 'limit' is 1 Created: 22/Jul/16 Updated: 02/Sep/16 Resolved: 16/Aug/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | 3.3.12 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Kyle Suarez | Assignee: | Kyle Suarez |
| Resolution: | Done | Votes: | 0 |
| Labels: | read-only-views | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Sprint: | Integration 2016-08-29 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
| Comments |
| Comment by Kyle Suarez [ 16/Aug/16 ] | ||||||
|
With the latest commit, views now supports drivers who specify singleBatch in their findOne helpers. There's also an integration test that tests views with the server's version of findOne. | ||||||
| Comment by Githook User [ 16/Aug/16 ] | ||||||
|
Author: {u'username': u'ksuarz', u'name': u'Kyle Suarez', u'email': u'kyle.suarez@mongodb.com'}Message: When converting a QueryRequest into an aggregation command, drop the | ||||||
| Comment by David Storch [ 25/Jul/16 ] | ||||||
|
A few notes from my offline conversation with kyle.suarez:
| ||||||
| Comment by Asya Kamsky [ 25/Jul/16 ] | ||||||
|
Note this applies to any negative batch size on views:
| ||||||
| Comment by Kyle Suarez [ 25/Jul/16 ] | ||||||
|
That sounds feasible. I believe we can accomplish this in QueryRequest::asAggregationCommand() – instead of returning a non-OK status if _wantMore is set, we just add an additional $limit of 1 immediately after the $match. | ||||||
| Comment by David Storch [ 25/Jul/16 ] | ||||||
|
I'm not sure it makes sense to add this functionality to the aggregation system. The notion of singleBatch doesn't seem particularly useful when there is already both batchSize and limit functionality. (In query land, this is holdover from the days of ntoreturn, when limit and batchSize were encapsulated in a single value.) Why can't findOne() be accomplished in agg using {$limit: 1}? | ||||||
| Comment by Bernie Hackett [ 22/Jul/16 ] | ||||||
|
To add a bit more color, most drivers support a negative limit. In OP_QUERY a negative ntoreturn tells the server to return as much as it can in one batch and close the cursor (or maybe never create a cursor in the first place?). Drivers have to keep supporting the same behavior to avoid breaking existing applications. |