Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-12814

Aggregation: cursor batchSize NaN is considered a negative number

    • Query Optimization
    • ALL

      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
      }
      

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            davide.italiano Davide Italiano
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: