As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
could you please answer my questions about geospatial data?
1. Is "_geoloc" field "Kinvey specific"? I mean can I create my own field say "location" and specify data for it or it must be "_geoloc"? I don't see any reason to keep only this name "_geoloc" as all the work is done my MongoDB.
2. What is the right approach to save the geospatial data in the database? For example I have list of points for the specific route, so the data structure could be like:
"route": {
"points": [
{"loc": [40, 50],
"name": "Camping"},
{"loc" : [40, 70],
"name": "Black sand beach"}
]
}
Another approach is to have all the points in the specific collection and a route would just reference to these points:
"route": {
"points": [
{"_id": 123},
{"_id": 125}
]
}
Which approach is better/suitable if I want to apply some geospacial queries or there is no any difference except the query itself?
Hey guys I understand you are very busy, but I hoped you are able to find couple of minutes to answer these 2 very simple question...
M
Morgan
said
over 9 years ago
Sorry for the delay!
1. In order to run geo queries MongoDB must create a special geo index that's all handled in the background! However you must put the geo data into the field named _geoloc for it work properly. You cannot change the name of this field.
2. Since your points have attributes the best way is to break the object into multiple entities of a single collection. For example, `{... "name": "Camping", "_geoloc": [40, 50]}
There isn't a better way to do it, it would just be too complicated to constructor queries otherwise.
_Note: if the points didn't have attributes you could stuff them all into an array of the _geoloc field. see [mongodb's docs](http://docs.mongodb.org/manual/core/geospatial-indexes/#GeospatialIndexing-Querying "mongodb's docs") for more details_
Kath Kleym
could you please answer my questions about geospatial data?
1. Is "_geoloc" field "Kinvey specific"? I mean can I create my own field say "location" and specify data for it or it must be "_geoloc"? I don't see any reason to keep only this name "_geoloc" as all the work is done my MongoDB.
2. What is the right approach to save the geospatial data in the database? For example I have list of points for the specific route, so the data structure could be like:
"route": {
"points": [
{"loc": [40, 50],
"name": "Camping"},
{"loc" : [40, 70],
"name": "Black sand beach"}
]
}
Another approach is to have all the points in the specific collection and a route would just reference to these points:
"route": {
"points": [
{"_id": 123},
{"_id": 125}
]
}
Which approach is better/suitable if I want to apply some geospacial queries or there is no any difference except the query itself?
Thanks