Hello, i have managed to do this one, but as i havent looked at this for a while im starting to struggle again. I have built an app (getting there) that takes your current lat/long and finds the nearest items to a position.
So far i have used the geolocation service for getting the lat/long of my current location and have used the database query service to work out the nearest two items. (Image DatabaseQueryService)
I have then captured my lat/long as local storage, which im assuming will then need to be fed into the database service before send? But i cant get it to work as it should.
Ive added this javascript:
var whereObject = { "location" : { "$nearSphere" : [parseFloat(currentlat), parseFloat(currentlong)] } };
return JSON.stringify(whereObject);
on the where and allocated the lat/long as can be seen in this image:
But when i do this its not returning anything at all, so the code is incorrect somewhere or there is a incorrect mapping.
If i remove the javascript and the mapping of the currentlat currentlong storage's the application just pulls back the information that was fed into the query as shown in the first image which is a set of coorindates i have put in manually.
I have done this before, but cannot see where i am now going wrong, so any help or advice would be greatly appreciated. Ive also made the application public for you to see: https://appery.io/app/mobile-frame?sr...
Many thanks
Ian