1

My Schema:

var coordinateSchema = new Schema({
    lat:Number,
    lng: Number

});
var waterSchema = new Schema({
    coordinates: [coordinateSchema]
})

I want to calculate a distance between those coordinate pairs and my current ones. Then I just want to return the ones thats distance is under a specific threshold.

The calculation of the distance is easy and already done. But as I'm pretty new to MongoDB I have no idea how to get those values, calalculate with them and then decide to return this entry or not.

Flo
  • 2,699
  • 4
  • 24
  • 46
  • 2
    Read on [MongoDB Geospatials](https://docs.mongodb.com/manual/applications/geospatial-indexes/). It does all the things you are asking for and more – Mustafa Jun 01 '17 at 19:14

0 Answers0