在mongo地理空间索引文档中有一个名为“distanceMultiplier”的参数,但没有解释。
任何人都知道它的作用吗?
答案 0 :(得分:2)
它将结果中返回的距离缩放为“dis”:
> 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"
]
}
},