public class GeoNearOperation extends Object implements AggregationOperation
geoNear aggregation operation.
We recommend to use the static factory method Aggregation.geoNear(NearQuery, String) instead of creating
instances of this class directly.
| Constructor and Description |
|---|
GeoNearOperation(NearQuery nearQuery,
String distanceField)
Creates a new
GeoNearOperation from the given NearQuery and the given distance field. |
| Modifier and Type | Method and Description |
|---|---|
org.bson.Document |
toDocument(AggregationOperationContext context)
|
GeoNearOperation |
useIndex(String key)
Optionally specify the geospatial index to use via the field to use in the calculation.
|
public GeoNearOperation(NearQuery nearQuery, String distanceField)
GeoNearOperation from the given NearQuery and the given distance field. The
distanceField defines output field that contains the calculated distance.nearQuery - must not be null.distanceField - must not be null.public GeoNearOperation useIndex(String key)
key - the geospatial index field to use when calculating the distance.GeoNearOperation.public org.bson.Document toDocument(AggregationOperationContext context)
AggregationOperationtoDocument in interface AggregationOperationCopyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.