Package com.mongodb.client.model
Interface GeoNearOptions
- All Superinterfaces:
Bson
The options for a
Aggregates.geoNear(com.mongodb.client.model.geojson.Point, java.lang.String, com.mongodb.client.model.GeoNearOptions)
pipeline stage.- Since:
- 4.8
- MongoDB documentation
- $geoNear
-
Field Summary
Fields inherited from interface org.bson.conversions.Bson
DEFAULT_CODEC_REGISTRY
-
Method Summary
Modifier and TypeMethodDescriptiondistanceMultiplier
(Number distanceMultiplier) static GeoNearOptions
ReturnsGeoNearOptions
that represents server defaults.includeLocs
(String includeLocs) This specifies the output field that identifies the location used to calculate the distance.Specify the geospatial indexed field to use when calculating the distance.maxDistance
(Number maxDistance) The maximum distance from the center point that the documents can be.minDistance
(Number minDistance) The minimum distance from the center point that the documents can be.Limits the results to the documents that match the query.Determines how MongoDB calculates the distance between two points.Methods inherited from interface org.bson.conversions.Bson
toBsonDocument, toBsonDocument
-
Method Details
-
geoNearOptions
ReturnsGeoNearOptions
that represents server defaults.- Returns:
GeoNearOptions
that represents server defaults.
-
distanceMultiplier
- Parameters:
distanceMultiplier
- The factor to multiply all distances returned by the query.- Returns:
- a new
GeoNearOptions
with the provided option set - Since:
- 4.8
-
includeLocs
This specifies the output field that identifies the location used to calculate the distance. This option is useful when a location field contains multiple locations. To specify a field within an embedded document, use dot notation.- Parameters:
includeLocs
- the output field- Returns:
- a new
GeoNearOptions
with the provided option set - Since:
- 4.8
-
key
Specify the geospatial indexed field to use when calculating the distance.- Parameters:
key
- the geospatial indexed field.- Returns:
- a new
GeoNearOptions
with the provided option set - Since:
- 4.8
-
minDistance
The minimum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall outside the specified distance from the center point.- Parameters:
minDistance
- the distance in meters for GeoJSON data.- Returns:
- a new
GeoNearOptions
with the provided option set - Since:
- 4.8
-
maxDistance
The maximum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall within the specified distance from the center point.- Parameters:
maxDistance
- the distance in meters for GeoJSON data.- Returns:
- a new
GeoNearOptions
with the provided option set - Since:
- 4.8
-
query
Limits the results to the documents that match the query. The query syntax is the usual MongoDB read operation query syntax.- Parameters:
query
- the query- Returns:
- a new
GeoNearOptions
with the provided option set - Since:
- 4.8
-
spherical
GeoNearOptions spherical()Determines how MongoDB calculates the distance between two points. By default, when this option is not provided, MongoDB uses $near semantics: spherical geometry for 2dsphere indexes and planar geometry for 2d indexes. When provided, MongoDB uses $nearSphere semantics and calculates distances using spherical geometry.- Returns:
- a new
GeoNearOptions
with the provided option set - Since:
- 4.8
-