-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 4.2 Required
-
Component/s: None
-
ALL
-
I have the following GeoNear aggregation I am running some documents. max_travel_radius is a float field on the objects that I am trying to pull into the maxDistance field for the aggregation, and is different for each document. Each time I run the query, it produces the error 'maxDistance must be a number', never allowing me to use a field although running it with a single, hard coded number works.
Ultimately what I am trying to do is send out a request for service from one customer application (the 'near' field) and check if there are any service providers (the 'key' field, which I have as point coordinates on the document) and only return providers which are within the given search radius ('maxDistance'). Each service provider document should be able to set their own max travel distance as a stored variable which can then be used in the GeoNear query to check if they are within range of a new service request.
Here is an example of a GeoNear query I am running:
{ "near": \{type: "Point", coordinates: [-111.887277, 40.770020]},
"distanceField": "dist.calculated",
"maxDistance": "max_travel_radius",
"key": "address_geopoint",
"uniqueDocs": "True"
}
- is related to
-
SERVER-63756 maxDistance field on GeoNear query not accepting field number
- Closed