Class GeoNear


  • @Deprecated(since="2.0",
                forRemoval=true)
    public final class GeoNear
    extends Object
    Deprecated, for removal: This API element is subject to removal in a future version.
    Outputs documents in order of nearest to farthest from a specified point.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  GeoNear.GeoNearBuilder
      Deprecated, for removal: This API element is subject to removal in a future version.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static GeoNear.GeoNearBuilder builder​(String distanceField)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a builder for a GeoNear pipeline stage
      String getDistanceField()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      Double getDistanceMultiplier()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      String getIncludeLocations()
      Deprecated, for removal: This API element is subject to removal in a future version.
      This specifies the output field that identifies the location used to calculate the distance.
      Long getLimit()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      Double getMaxDistance()
      Deprecated, for removal: This API element is subject to removal in a future version.
      The maximum distance from the center point that the documents can be.
      Long getMaxDocuments()
      Deprecated, for removal: This API element is subject to removal in a future version.
      The num option provides the same function as the limit option.
      double[] getNear()
      Deprecated, for removal: This API element is subject to removal in a future version.
      The point for which to find the closest documents.
      Query getQuery()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Limits the results to the documents that match the query.
      Boolean getSpherical()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Required if using a 2dsphere index.
    • Method Detail

      • builder

        public static GeoNear.GeoNearBuilder builder​(String distanceField)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Creates a builder for a GeoNear pipeline stage
        Parameters:
        distanceField - the field to process
        Returns:
        the GeoNearBuilder
      • getDistanceField

        public String getDistanceField()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns:
        the distance field used in this stage
      • getDistanceMultiplier

        public Double getDistanceMultiplier()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns:
        the distance multiplier used in this stage
      • getIncludeLocations

        public String getIncludeLocations()
        Deprecated, for removal: This API element is subject to removal in a future version.
        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.
        Returns:
        the field
      • getLimit

        public Long getLimit()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns:
        the maximum number of documents to return
      • getMaxDistance

        public Double getMaxDistance()
        Deprecated, for removal: This API element is subject to removal in a future version.
        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.
        Returns:
        the maximum
      • getMaxDocuments

        public Long getMaxDocuments()
        Deprecated, for removal: This API element is subject to removal in a future version.
        The num option provides the same function as the limit option. Both define the maximum number of documents to return. If both options are included, the num value overrides the limit value.
        Returns:
        the maximum
      • getNear

        public double[] getNear()
        Deprecated, for removal: This API element is subject to removal in a future version.
        The point for which to find the closest documents.

        If using a 2dsphere index, you can specify the point as either a GeoJSON point or legacy coordinate pair.

        If using a 2d index, specify the point as a legacy coordinate pair.

        Returns:
        the point
      • getQuery

        public Query getQuery()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Limits the results to the documents that match the query.
        Returns:
        the query
      • getSpherical

        public Boolean getSpherical()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Required if using a 2dsphere index. Determines how MongoDB calculates the distance. The default value is false.

        If true, then MongoDB uses spherical geometry to calculate distances in meters if the specified (near) point is a GeoJSON point and in radians if the specified (near) point is a legacy coordinate pair.

        If false, then MongoDB uses 2d planar geometry to calculate distance between points.

        If using a 2dsphere index, spherical must be true.

        Returns:
        true if using spherical geometry