0
我需要計算一組點之間的總距離。他們都有一個時間戳讓他們按正確的順序。我只能使用MongoDB。如何計算使用MongoDB的總距離
樣品採集:
{
"_id" : ObjectId("596cd354241aa3174056fb98"),
"spelerID" : 1,
"timestamp" : ISODate("2017-02-01T19:00:00.000Z"),
"coordinates" : {
"type" : "Point",
"coordinates" : [
4.29870386367084,
50.8357637566422
]
}
}
/* 2 */
{
"_id" : ObjectId("596cd354241aa3174056fbb4"),
"spelerID" : 1,
"timestamp" : ISODate("2017-02-01T19:00:01.000Z"),
"coordinates" : {
"type" : "Point",
"coordinates" : [
4.29868458167181,
50.8357575419868
]
}
}
/* 3 */
{
"_id" : ObjectId("596cd354241aa3174056fbce"),
"spelerID" : 1,
"timestamp" : ISODate("2017-02-01T19:00:02.000Z"),
"coordinates" : {
"type" : "Point",
"coordinates" : [
4.29867536067721,
50.8357376028214
]
}
}
我不知道如何計算正確的順序在這些點之間的距離。