在RoboMongo(0.9.0-RC09)中运行以下mongo查询会提供正确数量的文档(使用游标计数函数),而迭代所有文档只返回一小部分文档:MongoDB游标不会返回所有文档
var allDocuments = db.getCollection('mycollection').find({});
print(allDocuments.size()); // prints 170 000 -> correct
var count = 0;
allDocuments.forEach(function(doc) {
count++;
});
print(count); // 'randomly' prints values between 30 000 and 44 000
我们是否需要专门配置查询返回所有文件?
ohhh,我发现它,thx上帝。 –
谢谢!当我意识到并非所有的更新都已完成,但没有诊断/警告 - 跆拳道? – randomsock