1

I use Mongo with Mongoose. I have two coordinates points. I want to find users in a specific circle (with the first coordinates point as center). Then, for each users found, I want to calculate the distance from the second point.

How can I do this ? I can do one geospatial query, but two...

Ty by advance !

Adrien SAULNIER
  • 1,651
  • 1
  • 13
  • 19
  • 1
    afaik, mongodb only supports returning the distances for found documents from the search point. instead of having to do a query per user, simply calculate the distances you need client-side, with something like [this](https://stackoverflow.com/a/365853/4368485). – Dĵ ΝιΓΞΗΛψΚ Feb 10 '20 at 04:33
  • Ty for your response ! That's what I did, I use leaflet so I used "distanceTo" method. Ty again ! – Adrien SAULNIER Feb 11 '20 at 08:32

0 Answers0