Struggling with the complexities of sorting data reactively in a Meteor application has been a recurring challenge for me. Despite countless attempts, I have never come across a satisfactory solution to achieve the desired outcome. Each time, I reluctantly abandon the idea and opt for a different approach, leaving me disheartened.
However, I am hopeful that by simplifying the issue at hand, I may receive a valuable and enlightening response. It seems feasible to implement in a Meteor app, so here is my query:
Within my Accounts.users collection, I store the latitude and longitude of user locations in variables "lat" and "lon". The objective is to provide the current user with a list of the 10 nearest users. How can this be achieved, especially considering the complexity involved in calculating distances based on latitude and longitude?
It appears challenging to include such calculations in a MongoDB query condition. How have others successfully tackled this problem?
Your insights into this matter, no matter how theoretical, would be greatly appreciated.