| Constructor and Description |
|---|
GeoNearBuilder(String distanceField) |
| Modifier and Type | Method and Description |
|---|---|
GeoNear |
build() |
GeoNear.GeoNearBuilder |
setDistanceMultiplier(Double distanceMultiplier)
The factor to multiply all distances returned by the query.
|
GeoNear.GeoNearBuilder |
setIncludeLocations(String includeLocations)
This specifies the output field that identifies the location used to calculate the distance.
|
GeoNear.GeoNearBuilder |
setLimit(Long limit)
The maximum number of documents to return.
|
GeoNear.GeoNearBuilder |
setMaxDistance(Double maxDistance)
A distance from the center point.
|
GeoNear.GeoNearBuilder |
setMaxDocuments(Long num)
The maxDocuments option provides the same function as the limit option.
|
GeoNear.GeoNearBuilder |
setNear(double latitude,
double longitude)
Sets the point for which to find the closest documents.
|
GeoNear.GeoNearBuilder |
setNear(Point point)
Sets the point for which to find the closest documents.
|
GeoNear.GeoNearBuilder |
setQuery(Query query)
Limits the results to the documents that match the query.
|
GeoNear.GeoNearBuilder |
setSpherical(Boolean spherical)
If true, MongoDB references points using a spherical surface.
|
GeoNear.GeoNearBuilder |
setUniqueDocuments(Boolean uniqueDocuments)
Deprecated.
Deprecated since server version 2.6: Geospatial queries no longer return duplicate results. The $uniqueDocs operator
has no impact on results.
|
public GeoNearBuilder(String distanceField)
distanceField - The output field that contains the calculated distance. To specify a field within a subdocument, use dot
notation.public GeoNear build()
public GeoNear.GeoNearBuilder setDistanceMultiplier(Double distanceMultiplier)
distanceMultiplier - the distance multiplier used in this stagepublic GeoNear.GeoNearBuilder setIncludeLocations(String includeLocations)
includeLocations - the output field that identifies the location used to calculate the distancepublic GeoNear.GeoNearBuilder setLimit(Long limit)
limit - the maximumsetMaxDocuments(Long).public GeoNear.GeoNearBuilder setMaxDistance(Double maxDistance)
maxDistance - the maximumpublic GeoNear.GeoNearBuilder setMaxDocuments(Long num)
num - the maximumpublic GeoNear.GeoNearBuilder setNear(double latitude, double longitude)
latitude - the latitudelongitude - the longitudepublic GeoNear.GeoNearBuilder setNear(Point point)
point - a GeoJSON single point location.public GeoNear.GeoNearBuilder setQuery(Query query)
query - the query used to limit the documents to considerpublic GeoNear.GeoNearBuilder setSpherical(Boolean spherical)
spherical - true if spherical geometry should be used@Deprecated public GeoNear.GeoNearBuilder setUniqueDocuments(Boolean uniqueDocuments)
uniqueDocuments - true if only unique documents are required in the return value