MongoDB geoJSON point search -


i have following mongodb document wish query positions near specific point.

{ "_id" : objectid("59b7bffd7282280d6b03903b"), "identifier" : "70cd3559919a8c03", "timestamp_hour" : isodate("2017-09-12t11:00:00.000z"), "positions" : [      {         "timestamp" : isodate("2017-09-12t11:07:41.468z"),         "position" : {             "type" : "point",             "coordinates" : [                  -2.49004817008972,                  53.7085113525391             ]         }     },      {         "timestamp" : isodate("2017-09-12t11:08:20.173z"),         "position" : {             "type" : "point",             "coordinates" : [                  -1.49004817008972,                  53.7085113525391             ]         }     },      {         "timestamp" : isodate("2017-09-12t11:08:58.767z"),         "position" : {             "type" : "point",             "coordinates" : [                  -2.49004817008972,                  53.7085113525391             ]         }     },      {         "timestamp" : isodate("2017-09-12t11:09:37.572z"),         "position" : {             "type" : "point",             "coordinates" : [                  -2.49004817008972,                  54.7085113525391             ]         }     },      {         "timestamp" : isodate("2017-09-12t11:10:16.709z"),         "position" : {             "type" : "point",             "coordinates" : [                  -2.49004817008972,                  54.7085113525391             ]         }     },      {         "timestamp" : isodate("2017-09-12t11:10:55.742z"),         "position" : {             "type" : "point",             "coordinates" : [                  -2.49004817008972,                  54.7085113525391             ]         }     },      {         "timestamp" : isodate("2017-09-12t11:11:35.088z"),         "position" : {             "type" : "point",             "coordinates" : [                  -2.49004817008972,                  54.7085113525391             ]         }     },      {         "timestamp" : isodate("2017-09-12t11:12:14.327z"),         "position" : {             "type" : "point",             "coordinates" : [                  -2.49004507064819,                  54.7085037231445             ]         }     } 

the following query finds me data near specified point returns of positions array elements

find({'positions.position': {'$near': {$geometry: { type: "point",  coordinates: [ -2.49004507064819, 54.7085037231445 ] },         $maxdistance: 1} }}) 

how can document , positions elements relevant query rather of them because there 1 match in array?

many thanks


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -