Interface GeoNearOptions

All Superinterfaces:
Bson

public interface GeoNearOptions extends Bson
Since:
4.8
MongoDB documentation
$geoNear
  • Method Details

    • geoNearOptions

      static GeoNearOptions geoNearOptions()
      Returns GeoNearOptions that represents server defaults.
      Returns:
      GeoNearOptions that represents server defaults.
    • distanceMultiplier

      GeoNearOptions distanceMultiplier(Number 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

      GeoNearOptions includeLocs(String 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

      GeoNearOptions minDistance(Number 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

      GeoNearOptions maxDistance(Number 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

      GeoNearOptions query(Document 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