Class GeoNear.GeoNearBuilder

  • Enclosing class:
    GeoNear

    @Deprecated(since="2.0",
                forRemoval=true)
    public static class GeoNear.GeoNearBuilder
    extends Object
    Deprecated, for removal: This API element is subject to removal in a future version.
    Provides a builder for GeoNear instances.
    • Constructor Detail

      • GeoNearBuilder

        public GeoNearBuilder​(String distanceField)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Parameters:
        distanceField - The output field that contains the calculated distance. To specify a field within a subdocument, use dot notation.
        See Also:
        dot notation
    • Method Detail

      • build

        public GeoNear build()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Returns:
        the GeoNear instance as configured by this builder
      • setDistanceMultiplier

        public GeoNear.GeoNearBuilder setDistanceMultiplier​(Double distanceMultiplier)
        Deprecated, for removal: This API element is subject to removal in a future version.
        The factor to multiply all distances returned by the query. For example, use the distanceMultiplier to convert radians, as returned by a spherical query, to kilometers by multiplying by the radius of the Earth.
        Parameters:
        distanceMultiplier - the distance multiplier used in this stage
        Returns:
        this
      • setIncludeLocations

        public GeoNear.GeoNearBuilder setIncludeLocations​(String includeLocations)
        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. To specify a field within a subdocument, use dot notation.
        Parameters:
        includeLocations - the output field that identifies the location used to calculate the distance
        Returns:
        this
        See Also:
        dot notation
      • setLimit

        public GeoNear.GeoNearBuilder setLimit​(Long limit)
        Deprecated, for removal: This API element is subject to removal in a future version.
        The maximum number of documents to return. The default value is 100.
        Parameters:
        limit - the maximum
        Returns:
        this
      • setMaxDistance

        public GeoNear.GeoNearBuilder setMaxDistance​(Double maxDistance)
        Deprecated, for removal: This API element is subject to removal in a future version.
        A distance from the center point. Specify the distance in radians. MongoDB limits the results to those documents that fall within the specified distance from the center point.
        Parameters:
        maxDistance - the maximum
        Returns:
        this
      • setMaxDocuments

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

        public GeoNear.GeoNearBuilder setNear​(double latitude,
                                              double longitude)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Sets the point for which to find the closest documents.
        Parameters:
        latitude - the latitude
        longitude - the longitude
        Returns:
        this
      • setNear

        @Deprecated(since="2.0",
                    forRemoval=true)
        public GeoNear.GeoNearBuilder setNear​(Point point)
        Deprecated, for removal: This API element is subject to removal in a future version.
        use the driver-provided types instead
        Sets the point for which to find the closest documents.
        Parameters:
        point - a GeoJSON single point location.
        Returns:
        this
      • setNear

        public GeoNear.GeoNearBuilder setNear​(com.mongodb.client.model.geojson.Point point)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Sets the point for which to find the closest documents.
        Parameters:
        point - a GeoJSON single point location.
        Returns:
        this
      • setQuery

        public GeoNear.GeoNearBuilder setQuery​(Query query)
        Deprecated, for removal: This API element is subject to removal in a future version.
        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 used to limit the documents to consider
        Returns:
        this
        MongoDB documentation
        read operation query syntax
      • setSpherical

        public GeoNear.GeoNearBuilder setSpherical​(Boolean spherical)
        Deprecated, for removal: This API element is subject to removal in a future version.
        If true, MongoDB references points using a spherical surface. The default value is false.
        Parameters:
        spherical - true if spherical geometry should be used
        Returns:
        this