Thursday 1 June 2017

Mongoose get all Elements where a precalculation matches

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.



via Florian

No comments:

Post a Comment