[SERVER-11223] Aggregation cursor rejects unknown options Created: 16/Oct/13  Updated: 10/Dec/14  Resolved: 23/Oct/13

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: 2.5.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Hannes Magnusson Assignee: Unassigned
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Gantt Dependency
Operating System: ALL
Participants:

 Description   

> db.messages.aggregate([ ], { cursor: { foo: 1} })
assert: command failed: {
	"errmsg" : "exception: cursor object can't contain fields other than batchSize",
	"code" : 16955,
	"ok" : 0
} : aggregate with cursor failed
Error: Printing Stack Trace
    at printStackTrace (src/mongo/shell/utils.js:38:15)
    at doassert (src/mongo/shell/assert.js:6:5)
    at Function.assert.commandWorked (src/mongo/shell/assert.js:238:5)
    at DBCollection.aggregate (src/mongo/shell/collection.js:907:12)
    at (shell):1:13
2013-10-16T13:46:07.155-0700 command failed: {
	"errmsg" : "exception: cursor object can't contain fields other than batchSize",
	"code" : 16955,
	"ok" : 0
} : aggregate with cursor failed at src/mongo/shell/assert.js:7

This means that when we add new cursor option in later releases it'll be very annoying for drivers to handle and they'd need to wash the options first.

We've shot ourself in the foot before by doing this sort of validation which prohibits future improvements.



 Comments   
Comment by Mathias Stearn [ 23/Oct/13 ]

We need to be strict to ensure that we do what the user is requesting. If the user asks for something the server doesn't support, the driver should still pass it through and the server will generate an appropriate error message.

Generated at Thu Feb 08 03:25:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.