christkv/node-mongodb-native — Issue #447: Can only get 101 results when there's a lot more
Author: quartzjer
Created: 2011-12-15 23:17:06+00:00
State: open

Using this code:

function findWrap(a,b,c,cbEach,cbDone){
var cursor = (b.fields) ? c.find(a, b) : c.find(a);
if (b.sort) cursor.sort(b.sort);
if (b.limit) cursor.limit(b.limit);
if (b.offset) cursor.skip(b.offset);
cursor.count(function(err,c){console.error("COUNT "+c)});
var total = 0;
cursor.each(function(err, item) {
if (item != null) {
total++;
cbEach(item);
} else {
cursor.count(function(err,c){console.error("TOTAL "+total+" COUNT "+c)});
cbDone();
}
});
}

I get the strangest results:

COUNT 16871
TOTAL 101 COUNT 16871

I can't fathom why this would be, any help?