DocumentDB LogoDocumentDB
HomeGitHubDiscordDocsPackagesBlogs
Back to DocumentationMQL Documentation
Commands
Aggregation
Query And Write
Operators
Accumulators
Aggregation
Arithmetic Expression
Array Expression
Array Query
Array Update
Bitwise
Bitwise Query
Bitwise Update
Comparison Query
Conditional Expression
Data Size
Date Expression
Element Query
Evaluation Query
Field Update
Geospatial
$box
$center
$centerSphere
$geoIntersects
$geometry
$geoWithin
$maxDistance
$minDistance
$near
$nearSphere
$polygon
Literal Expression
Logical Query
Miscellaneous
Miscellaneous Query
Object Expression
Projection
Set Expression
Timestamp Expression
Variable Expression
Window Operators
Reference/Operators/Geospatial

MongoDB Query Language (MQL) Geospatial Operators

Geospatial operators perform operations on geographic data and spatial relationships.

$box

The $box operator defines a rectangular area for geospatial queries using coordinate pairs.

$center

The $center operator specifies a circle using legacy coordinate pairs for $geoWithin queries.

$centerSphere

The $centerSphere operator specifies a circle using spherical geometry for $geoWithin queries.

$geoIntersects

The $geoIntersects operator selects documents whose location field intersects with a specified GeoJSON object.

$geometry

The $geometry operator specifies a GeoJSON geometry for geospatial queries.

$geoWithin

The $geoWithin operator selects documents whose location field is completely within a specified geometry.

$maxDistance

The $maxDistance operator specifies the maximum distance that can exist between two points in a geospatial query.

$minDistance

The $minDistance operator specifies the minimum distance that must exist between two points in a geospatial query.

$near

The $near operator returns documents with location fields that are near a specified point, sorted by distance.

$nearSphere

The $nearSphere operator returns documents whose location fields are near a specified point on a sphere, sorted by distance on a spherical surface.

$polygon

The $polygon operator defines a polygon for geospatial queries, allowing you to find locations within an irregular shape.

Copyright © DocumentDB a Series of LF Projects, LLC. For web site terms of use, trademark policy and other project policies please see https://lfprojects.org.