Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-642

raw mode batched reads are broken

      reading data in raw mode that is an exact multiple of the batch size items errors out.
      If the data size < batch size or data size % batch size != 0, it works.
      If raw: false is specified, it works.
      tested with mongodb V2.1.3 and V2.1.4, node v0.10.41

      mongoClient.connect(url, dbOpts, function(err, db) {
        var data = []
        for (var i=0; i<20; i++) data.push({a:i});
        db = db.db('test');
        db.collection("rawtest").remove({}, function(err) {
          db.collection("rawtest").insert(data, {w: 1}, function(err) {
            db.collection("rawtest").find({}, {raw: true}, function(err, cursor2) {
      	cursor2.batchSize(10);
      	cursor2.toArray(function(err, items2) {
      	  console.log("err:", err)
      	  //console.log(items2);
      	  //console.log("item count:", items2.length)
      	  db.close();
      	})
            });
          });
        });
      });
      
      % node mongo-test.js
      err: { [MongoError: invalid getMore result returned for cursor id 57051939534]
        name: 'MongoError',
        message: 'invalid getMore result returned for cursor id 57051939534' }
      

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            andrask Andras
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: