[SERVER-12814] Aggregation: cursor batchSize NaN is considered a negative number Created: 21/Feb/14  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: 2.6.0-rc0
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Davide Italiano Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: 26qa, aggregation, grab-bag, query-44-grooming, usability
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-12813 Overflow when converting double value... Open
Assigned Teams:
Query Optimization
Operating System: ALL
Participants:

 Description   

I'm puzzled for a couple of reasons:
1) NaN is not a negative numbers so the error message should be at least different.
2) Other operations handle NaN differently, e.g. find().limit(Nan) is equivalent to find().limit().

> use foo
switched to db foo
> var bigArray = [];
> for (var i = 0; i < 1000; ++i) { bigArray.push(i); }
1000
> var bigStr = Array(1001).toString();
> for (var i = 0; i < 100; ++i) { db.goo.insert({_id: i, bigArray: bigArray, bigStr: bigStr})};
WriteResult({ "nInserted" : 1 })
> var cursor = db.runCommand({aggregate: "goo", pipeline: [{$unwind:'$bigArray'}], cursor : {batchSize: NaN}})
> cursor
{
	"errmsg" : "exception: Cursor batchSize must not be negative",
	"code" : 16957,
	"ok" : 0
}


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