Help me please! I have a problem with query in mongodb. I want to return data with distance from my location to location of place (have multiple location). My data in mongodb as:
[{
"name" : "Bob",
"place" : [
{
"location" : {
"type" : "Point",
"coordinates" : [
106,
10
]
}
},
{
"location" : {
"type" : "Point",
"coordinates" : [
106,
10
]
}
}
]
}]
And I can't get distance for each "location" in "place". I want to return data as
[{
"name" : "Bob",
"place" : [
{
"location" : {
"type" : "Point",
"coordinates" : [
106,
10
]
},
"distance":5322
},
{
"location" : {
"type" : "Point",
"coordinates" : [
106,
10
]
},
"distance":2345
}
]
}]