我有一个文档集合,像这样:
{
...
"CurrentLocation" : {
"type" : "Point",
"coordinates" : [
-92.48436693078111,
35.85223020932276
]
}
...
}
我需要使用两个可能的中心点进行"$near"查询:
db.Truck.find({
"$or": [{
"DestinationLocation": {
"$near": {
"$geometry": {
"type": "Point",
"coordinates": [-117.256875, 41.856405]
},
"$maxDistance": 100000.0
}
}
}, {
"DestinationLocation": {
"$near": {
"$geometry": {
"type": "Point",
"coordinates": [-112.256875, 40.856405]
},
"$maxDistance": 100000.0
}
}
}]
})
Mongo返回了一个错误:
error:
{
"$err" : "Can't canonicalize query: BadValue Too many geoNear expressions",
"code" : 17287
}
除了在应用程序中进行数据联合之外,是否有任何请求使用两个点的$near方法的方法?谢谢。