Mongoose / MongoDB Minimum Distance between two co-ordinates

Hi

I have a list of x,y co-ordinates (note not GEO Json data – just sample x=1, y=100 etc data)

Each building has a x,y co-ordinate.

The function (can be node – but prefer to calculate directly in db) the user will choose a building and the calculations will return the nearest building having compared all other buildings in the DB co-ordinates.

ps - I am just looking at how to supply and x,y co-ords to mongoose and have the db return the nearest building.

Any suggestions on Mongoose code for this?

Sample data:
name , id, x-coord, y-coord
hospital, 1, 100,200
tower, 2, 302,100

etc.

thx!
Karen

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.