【发布时间】:2014-06-10 20:13:08
【问题描述】:
我需要搜索框内的所有点。所以我在 mongoDB 中使用以下查询
db.places.find({
"loc" : {
"$geoWithin" : {
"$box": [
[ 0 , 0 ] ,
[ 100 , 100 ]
]
}
}
})
现在我有多个要在其中搜索的框,我想获取位于任何框中的所有点。我想要类似的东西
db.places.find({
"loc": {
"$geoWithin": {
"$box":[ [ 0 , 0 ], [ 25 , 25 ] ],
[ [ 40 , 40 ] , [ 75 , 75 ] ],
[ [ 90 , 90 ] , [ 100 , 100 ] ]
}
}
})
我不能像使用$or 那样使用它短路评估。我也不能使用 aggregation,因为 aggregation 仅支持 $geonear。我不想为每个框打一个单独的查询。请建议。
【问题讨论】:
标签: mongodb mongoose pymongo geojson aggregation-framework