[SERVER-11225] Aggregation as cursor error message missing closing quote Created: 16/Oct/13  Updated: 10/Dec/14  Resolved: 17/Oct/13

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

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

mongod 2.5.3
mongo 2.4.2


Issue Links:
Gantt Dependency
Related
is related to DOCS-2098 Aggregation: Clearly document mongo s... Closed
Operating System: ALL
Participants:

 Description   

> db.messages.aggregate( [     {$project: {             "headers.Mime-Version":1,             _id:0         }     }, {$limit: 0} ])
assert: command failed: { "ok" : 0, "errmsg" : "unrecognized field \"cursor" } : 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-16T14:33:44.254-0700 command failed: { "ok" : 0, "errmsg" : "unrecognized field \"cursor" } : aggregate with cursor failed at src/mongo/shell/assert.js:7
>

The error message seems to be missing closing " (eg: "unrecognized field \"cursor\"").



 Comments   
Comment by Matt Dannenberg [ 17/Oct/13 ]

This is intentional and is necessary to preserve backwards compatibility. It is to mimic the result of requesting a cursor from a pre-2.6 mongod. https://github.com/mongodb/mongo/blob/1a90352d5f09b436eb67ec53b9bdf77a75dd70f5/src/mongo/s/commands_public.cpp#L2039

Comment by Daniel Pasette (Inactive) [ 17/Oct/13 ]

I don't get that result with mongod git hash: d1c2ae72c4829ed77cb6b7fe42e486910483caff and a 2.4.2 shell. I get:

> db.f.aggregate( [     {$project: {             "headers.Mime-Version":1,             _id:0         }     }, {$limit: 0}])
Error: Printing Stack Trace
    at printStackTrace (src/mongo/shell/utils.js:37:7)
    at DBCollection.aggregate (src/mongo/shell/collection.js:897:1)
    at (shell):1:6
Thu Oct 17 01:09:23.065 JavaScript execution failed: aggregate failed: {
	"errmsg" : "exception: the limit must be positive",
	"code" : 15958,
	"ok" : 0

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