How do I calculate route distance between many GeoJSON points in MongoDB? Can I have a database query that sort items by their date field, then calculates the distance between points and finally sums all of then to calculate the total distance?
Here are some examples of my data:
{
_id: 599cfc236ed0d81c98007f66
tracerId: 59a07ea26ed0d81d78001acd
loc {
type: "2dsphere",
coordinates: [ 159.9, -37.92 ]
},
date: 2017-08-26 00:16:42,
speed: 58,
}
{
_id: 59a074d46ed0d81d78001acc
tracerId: 59a07ea26ed0d81d78001acd
loc {
type: "2dsphere",
coordinates: [ 160, -38.20 ]
},
date: 2017-08-26 00:18:42,
speed: 75,
}
{
_id: 59a074d46ed0d81d78ac11cc
tracerId: 59a07ea26ed0d81d78001acd
loc {
type: "2dsphere",
coordinates: [ 160.222, -38.92 ]
},
date: 2017-08-26 00:20:42,
speed: 60,
}