- Reference >
- Operators >
- Query and Projection Operators >
- Geospatial Query Operators >
- $geoIntersects
$geoIntersects¶
-
$geoIntersects
¶ New in version 2.4.
The
$geoIntersects
operator is a geospatial query operator that selects all locations that intersect with a GeoJSON object. A location intersects a GeoJSON object if the intersection is non-empty. This includes documents that have a shared edge. The$geoIntersects
operator uses spherical geometry.The
2dsphere
geospatial index supports$geoIntersects
.To query for intersection, pass the GeoJSON object to
$geoIntersects
through the$geometry
operator. Use the following syntax:Important
Specify coordinates in this order: “longitude, latitude.”
The following example uses
$geoIntersects
to select all indexed points and shapes that intersect with the polygon defined by thecoordinates
array.Note
Any geometry specified with GeoJSON to
$geoIntersects
queries, must fit within a single hemisphere. MongoDB interprets geometries larger than half of the sphere as queries for the smaller of the complementary geometries.