Mongo,通过geo数据发现总是被限制为100 [英] Mongo and find always limited to 100 with geo data

查看:199
本文介绍了Mongo,通过geo数据发现总是被限制为100的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



首先我填写下面的查询:

$对于(i = 0; i <10000000; i ++){db.location.insert({_id:Math.floor((Math.random ()* 10000000000)+1),position:[Math.round(Math.random()* 10000)/ 10000,Math.round(Math.random()* 10000)/ 10000]})}

下一个:

  db.location.ensureIndex({position:2d})

然后执行查询: p>

  db.location.find({position:{$ near:[1,1],$ maxDistance:1 / 111.12}}) 

无论我尝试做什么,我都会得到大小或计数结果100。



我在文档中注意到defult的限制是100.我也试着用大于100的值来覆盖它。不幸的是我失败了。



你曾经遇到过这种情况么?

解决方案

<获取所有文档查询,如

  cordinate = [1,1]; 
maxDistance = 1 / 111.12;

db.location.find({position:{$ within:
{$ center:[cordinate,maxDistance]}
}
});


While trying to experiment with mongo performance I found strange behaviour of my mongo db.

First of all i filled it with the following query:

for (i=0; i < 10000000; i++){db.location.insert( {_id: Math.floor((Math.random()*10000000000)+1), position: [Math.round(Math.random()*10000)/10000, Math.round(Math.random()*10000)/10000]} )}

next:

db.location.ensureIndex( {position: "2d"} )

Then i execute query:

db.location.find( {position: { $near: [1,1], $maxDistance: 1/111.12  } } )

Whatever i try to do i get always size or count result 100.

I noticed in documentation that defualt limit is 100. I tried also to override it with bigger than 100 values. Unfortunately I failed.

Have you ever encountered such a case?

解决方案

To get all document query like

cordinate = [1,1];
maxDistance = 1/111.12 ;

db.location.find({"position" : {"$within" : 
                                      {"$center" : [cordinate , maxDistance ]}
                                }
                  });

这篇关于Mongo,通过geo数据发现总是被限制为100的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆