[SERVER-27030] Improve the error message when issuing a legacy find/getMore on a view Created: 14/Nov/16 Updated: 19/Nov/16 Resolved: 16/Nov/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 3.4.0-rc3 |
| Fix Version/s: | 3.4.0-rc4 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Craig Wilson | Assignee: | James Wahlin |
| 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 | ||||||||||||
| Operating System: | ALL | ||||||||||||
| Sprint: | Query 2016-11-21 | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
When performing a legacy find, getMore or killCursors on a view, users get the error message "Namespace <view> is a view, not a collection". For example, in the shell,
This is rather unhelpful from a user's standpoint. We should consider making this error more user-friendly and explicitly state that legacy find and getMore is not supported on a view. |
| Comments |
| Comment by Githook User [ 16/Nov/16 ] |
|
Author: {u'username': u'jameswahlin', u'name': u'James Wahlin', u'email': u'james.wahlin@10gen.com'}Message: |
| Comment by James Wahlin [ 15/Nov/16 ] |
|
Legacy OP_KILL_CURSORS will work against a cursor established on a view. We store the underlying collection namespace in the cursor manager. As the legacy kill operation takes only a cursorId, it will map this ID correctly and kill the cursor. For the kill cursors command we take a cursorId and the view namespace. This code path has logic to convert the view namespace to the underlying collection namespace so that the requested namespace matches that in the cursor manager. Given the above no work is needed for killcursors. This ticket will improve the error message returned for legacy find and getMore. |
| Comment by J Rassi [ 15/Nov/16 ] |
|
Note that users may get the false impression that they are able to use old drivers (without MongoDB 3.2 support) with views, since aggregation operations against views with these drivers will succeed as long as their results fit within a single batch (101 results or 16MB, by default). Once they run an aggregation operation where the results exceed a single batch, though (for example, when moving from testing to production), an error will be returned, since the driver will send an incompatible OP_GET_MORE request to fetch the remaining results. |
| Comment by Kyle Suarez [ 14/Nov/16 ] |
|
Re-opening this issue to work it into a ticket that improves the error message when running a legacy find or getMore on a view. |
| Comment by Bernie Hackett [ 14/Nov/16 ] |
|
I guess this means to interact with views a driver has to have explicit support for >= MongoDB 3.2? |
| Comment by Kyle Suarez [ 14/Nov/16 ] |
|
This behavior is intended. Per an off-ticket conversation with craiggwilson, the Find/GetMore/KillCursors Drivers Spec mentions that
So, spec-compliant drivers shouldn't be issuing OP_GETMORE for CRUD operations on a version of MongoDB that supports read-only views. I'm therefore closing this ticket as Won't Fix. |