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描述
$geoIntersects Selects geometries that intersect with a GeoJSON geometry. 选择与GeoJSON几何图形相交的几何图形。The 2dsphere index supports $geoIntersects.2dsphere索引支持$geoIntersects
$geoWithin Selects geometries within a bounding GeoJSON geometry. 选择边界GeoJSON几何图形中的几何图形。The 2dsphere and 2d indexes support $geoWithin.2dsphere2d索引支持$geoWithin
$near Returns geospatial objects in proximity to a point. 返回点附近的地理空间对象。Requires a geospatial index. 需要地理空间索引。The 2dsphere and 2d indexes support $near.2dsphere2d索引支持$near
$nearSphere Returns 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描述
$box Specifies a rectangular box using legacy coordinate pairs for $geoWithin queries. $geoWithin查询指定使用传统坐标对的矩形框。The 2d index supports $box.2d索引支持$box
$center Specifies a circle using legacy coordinate pairs to $geoWithin queries when using planar geometry. 使用平面几何图形时,使用传统坐标对在$geoWithin查询中指定圆。The 2d index supports $center.2d索引支持$center
$centerSphere Specifies 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
$geometry Specifies a geometry in GeoJSON format to geospatial query operators.为地理空间查询运算符指定GeoJSON格式的几何图形。
$maxDistance Specifies a maximum distance to limit the results of $near and $nearSphere queries. 指定最大距离以限制$near$nearSphere查询的结果。The 2dsphere and 2d indexes support $maxDistance.2dsphere2d索引支持$maxDistance
$minDistance Specifies a minimum distance to limit the results of $near and $nearSphere queries. 指定限制$near$nearSphere查询结果的最小距离。For use with 2dsphere index only.仅适用于2dsphere索引。
$polygon Specifies a polygon to using legacy coordinate pairs for $geoWithin queries. 指定要在$geoWithin查询中使用传统坐标对的多边形。The 2d index supports $center.2d索引支持$center
$uniqueDocs Deprecated. 不赞成。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查询,以确保即使文档多次匹配查询,查询也会返回一次文档。