I have tried dozens of variations of the code provided above to no avail.
{ "location" : { "$nearSphere" : [34.758913,-118.1956949], "$maxDistanceInMiles" : 25}}
All attempts to replace the fixed coordinates with storage variables have failed. I have tried too many permutations to list.
I appreciate the help from Bruce, however I still have not found a solution.
The support group at Appery has yet to provide any viable assistance. Have I not posed the question properly? I spent a significant amount of time researching this issue before posting. There are hundreds of geolocation questions, and I've read most of them without success.
There is ample documentation, such as;
{
"location" : {
"$nearSphere" : [48.208, 16.373],
"$maxDistanceInKilometers" : 550
}
}
However, there are no viable samples that provide the proper syntax using storage variables in place of the fixed coordinates. I've spent hours working on this but cant find the correct syntax.
I have also taken code directly from the documentation...
{ "location" : { "$nearSphere" : [34.758913,-118.1956949], "$maxDistanceInMiles" : 1 } }
and tested it in the list service. I get either all records, regardless of distance, or an error.
One observation, the "location" geopoint column in my DB lists latitude, longitude. The code above has that reversed.
The gepoint column in my db is named "location" . The storage variables are "currentLat" and currentLng.
I am quite certain the solution is simple and I am just missing something. I'd appreciate some assistance from the appery staff or anyone else.