MongoDB nearSphere只返回100个结果?

为什么$ nearsphere查询总是返回100个结果?

db.mytable.find({"geo":{"$nearSphere":[41.393552,2.171344999999974],"$maxDistance":0.007}}).limit(500).count() -->>> 100 results 

无论$ maxdistance的值如何,我的表格都有超过30,000条logging。

检查这个: https : //jira.mongodb.org/browse/SERVER-739

我认为asynchronous代码是击中db.close(); .each循环完成之前,出于某种原因,每个人都只有100个结果,所以这里是一个解决方法。

 var url = 'mongodb://localhost:27017/mydb'; MongoClient.connect(url, function(err, db) { var i=0; var collection = db.collection('documents'); collection.find().each(function(err, docs) { if (docs != null){ console.log(docs); console.log(i); i++; if( i >= docs.length ){ db.close(); } } }); });