0
有一個$ geoIntersection。但它是否存在類似於$ geoExclusion的內容? 我想找到不與某些區域相交的多邊形。
有一個$ geoIntersection。但它是否存在類似於$ geoExclusion的內容? 我想找到不與某些區域相交的多邊形。
嘗試使用$not
:
db.places.find({ "loc" : { "$not" : { "$geoIntersects" : {
"$geometry" : {
"type" : "Polygon",
"coordinates" : [[ [ 0, 0 ], [ 3, 6 ], [ 6, 1 ], [ 0, 0 ] ]]
}
} } } })
也許值得注意的是,unline'$ near'或'$ nearSphere'的'$ geoIntersects'和'$ geoWitin'運營商不需要索引。這裏'$ not'排除否定了索引,並通過集合使選擇蠻力。但選擇「反」的邏輯是合理的。 – 2015-01-15 21:43:07