开发者

Mongo geospatial index options

开发者 https://www.devze.com 2023-02-11 07:14 出处:网络
In the mongo geospatial index documentation there is a parameter called \"distanceMultiplier\", but t开发者_如何学Chere\'s no explanation.

In the mongo geospatial index documentation there is a parameter called "distanceMultiplier", but t开发者_如何学Chere's no explanation.

Anyone know what it does?


It scales the distance returned as "dis" in the result:

> db.runCommand({geoNear: 'places', near: [50, 50]})
{
    "ns" : "geotest.places",
    "near" : "1100110000001111110000001111110000001111110000001111",
    "results" : [
        {
            "dis" : 7.853626559350774,
            "obj" : {
                "_id" : ObjectId("4d4b20890da611546bcbdf96"),
                "loc" : {
                    "lat" : 42.739037,
                    "long" : 52.992964
                },
                "category" : [
                    "1"
                ]
            }
        },

> db.runCommand({geoNear: 'places', near: [50, 50], distanceMultiplier: 4})
{
    "ns" : "geotest.places",
    "near" : "1100110000001111110000001111110000001111110000001111",
    "results" : [
        {
            "dis" : 31.414506237403096,
            "obj" : {
                "_id" : ObjectId("4d4b20890da611546bcbdf96"),
                "loc" : {
                    "lat" : 42.739037,
                    "long" : 52.992964
                },
                "category" : [
                    "1"
                ]
            }
        },
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号