Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Performance mongodb(meteor)中$near操作的性能如何_Performance_Mongodb_Search_Meteor - Fatal编程技术网

Performance mongodb(meteor)中$near操作的性能如何

Performance mongodb(meteor)中$near操作的性能如何,performance,mongodb,search,meteor,Performance,Mongodb,Search,Meteor,我正在使用meteor实现一个“近”查询。 事实上,它工作得很好。但我想知道服务器端的性能如何 这是近距离查询的代码: var geolocation = Session.get('location'); var lnglat = [0,0]; if(geolocation){ lnglat = [geolocation.longitude,geolocation.latitude]; } if(

我正在使用meteor实现一个“近”查询。 事实上,它工作得很好。但我想知道服务器端的性能如何

这是近距离查询的代码:

        var geolocation = Session.get('location');
        var lnglat = [0,0];
        if(geolocation){
          lnglat = [geolocation.longitude,geolocation.latitude];
        }
        if(Session.get('type') === 'near'){
            return Posts.find({
              location: {
                $near: {
                  $geometry: {
                    type: "Point",
                    coordinates: lnglat
                  },
                  $maxDistance: 20000   //meters
                }
              }
            });
        }

最好的答案是github中的mongodb源代码(显然!duh!)。根据文件,确保索引非常重要。链接:“性能”和“服务器端”是什么意思?你是说当我的数据库中有更多的项目时,mongodb将如何执行?你希望得到什么样的答案?实际上我不想用错误的方式使用搜索。我对mongodb不熟悉,所以这个问题并不完美。我认为马里奥的答案是最好的。@codsimba正如马里奥建议的那样,如果一个人不熟悉某项技术,阅读文档通常会有所帮助。这样做之后,需要进行一些学习迁移。事实证明,创建测试数据对于性能测试非常有效。