Database Manual / Reference / Query Language / Query Predicates

Geospatial Query Predicate Operators地理空间查询谓词运算符

Geospatial operators return data based on geospatial expression conditions.地理空间运算符根据地理空间表达式条件返回数据。

Query Predicate Operators查询谓词运算符

Name名称Description描述
$geoIntersectsSelects geometries that intersect with a GeoJSON geometry. 选择与GeoJSON几何图形相交的几何图形。The 2dsphere index supports $geoIntersects.2dsphere索引支持$geoIntersects
$geoWithinSelects geometries within a bounding GeoJSON geometry. 在边界GeoJSON几何图形中选择几何图形。The 2dsphere and 2d indexes support $geoWithin.2dsphere2d索引支持$geoWithin
$nearReturns geospatial objects in proximity to a point. Requires a geospatial index. 返回点附近的地理空间对象。需要地理空间索引。The 2dsphere and 2d indexes support $near.2dsphere2d索引支持$near
$nearSphereReturns geospatial objects in proximity to a point on a sphere. Requires a geospatial index. 返回球体上某点附近的地理空间对象。需要地理空间索引。The 2dsphere and 2d indexes support $nearSphere.2dsphere2d索引支持$nearSphere

Geometry Specifiers几何体规范

Use the following specifiers in geospatial query predicates to specify geometric elements to query against.在地理空间查询谓词中使用以下说明符指定要查询的几何元素。

Name名称Description描述
$boxSpecifies a rectangular box using legacy coordinate pairs for $geoWithin queries. 使用旧坐标对为$geoWithin查询指定矩形框。The 2d index supports $box.2d索引支持$box
$centerSpecifies a circle using legacy coordinate pairs to $geoWithin queries when using planar geometry. 使用平面几何图形时,使用旧坐标对指定圆到$geoWithin查询。The 2d index supports $center.2d索引支持$center
$centerSphereSpecifies a circle using either legacy coordinate pairs or GeoJSON format for $geoWithin queries when using spherical geometry. 使用球面几何图形时,使用传统坐标对或GeoJSON格式为$geoWithin查询指定圆。The 2dsphere and 2d indexes support $centerSphere.2dsphere2d索引支持$centerSphere
$geometrySpecifies a geometry in GeoJSON format to geospatial query operators.为地理空间查询运算符指定GeoJSON格式的几何图形。
$maxDistanceSpecifies a maximum distance to limit the results of $near and $nearSphere queries. 指定最大距离以限制$near$nearSphere查询的结果。The 2dsphere and 2d indexes support $maxDistance.2dsphere2d索引支持$maxDistance
$minDistanceSpecifies a minimum distance to limit the results of $near and $nearSphere queries. For use with 2dsphere index only.指定限制$near$nearSphere查询结果的最小距离。仅适用于2dsphere索引。
$polygonSpecifies a polygon to using legacy coordinate pairs for $geoWithin queries. $geoWithin查询指定使用传统坐标对的多边形。The 2d index supports $polygon.2d索引支持$polygon