$geometry
$geometry
-
The$geometry
operator specifies a GeoJSON geometry for use with the following geospatial query operators:$geometry
运算符指定一个GeoJSON几何体,用于以下地理空间查询运算符:$geoWithin
,$geoIntersects
,$near
, and$nearSphere
.$geometry
usesEPSG:4326
as the default coordinate reference system (CRS).$geoWithin
、$geoIntersects
、$near
和$nearSphere
几何图形使用EPSG:4326
作为默认坐标参考系统(CRS)。To specify GeoJSON objects with the default CRS, use the following prototype for要使用默认CRS指定GeoJSON对象,请使用$geometry
:$geometry
的以下原型:$geometry: {
type: "<GeoJSON object type>",
coordinates: [ <coordinates> ]
}To specify a single-ringed GeoJSON polygon with a custom MongoDB CRS, use the following prototype (available only for要使用自定义MongoDB CRS指定单环GeoJSONpolygon,请使用以下原型(仅适用于$geoWithin
and$geoIntersects
):$geoWithin
和$geoIntersects
):$geometry: {
type: "Polygon",
coordinates: [ <coordinates> ],
crs: {
type: "name",
properties: { name: "urn:x-mongodb:crs:strictwinding:EPSG:4326" }
}
}The custom MongoDB coordinate reference system has a strict counter-clockwise winding order.自定义MongoDB坐标参考系统具有严格的逆时针缠绕顺序。ImportantIf specifying latitude and longitude coordinates, list the longitude first, and then latitude.如果指定纬度和经度坐标,请先列出经度,然后列出纬度。Valid longitude values are between有效的经度值介于-180
and180
, both inclusive.-180
和180
之间(包括-180
和180
)。Valid latitude values are between有效的纬度值介于-90
and90
, both inclusive.-90
和90
之间(包括-90
和90
)。