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

On this page本页内容

Note注意

For details on specific operator, including syntax and examples, click on the specific operator to go to its reference page.有关特定运算符的详细信息,包括语法和示例,请单击特定运算符以转到其参考页。

Operators运算符

Query Selectors查询选择器

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索引支持$geoin
$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几何说明符

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. 在使用球形几何体时,为$geoWithin查询指定使用传统坐标对或GeoJSON格式的圆。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. 指定限制$near$nearSphere查询结果的最小距离。For use with 2dsphere index only.仅用于2dsphere索引。
$polygonSpecifies a polygon to using legacy coordinate pairs for $geoWithin queries. 指定要为$geoWithin查询使用传统坐标对的多边形。The 2d index supports $center.2d索引支持$center
$uniqueDocsDeprecated. 不赞成。Modifies a $geoWithin and $near queries to ensure that even if a document matches the query multiple times, the query returns the document once.修改$geoWithin$near查询,以确保即使文档多次匹配查询,查询也只返回一次文档。
←  $where$geoIntersects →