开发者

Mongo geospatial index options

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜