MongoDB - how to use the best way for GEO and addresses?

I want to find the best way to solve my problem. I don't know how best to use MongoDB in my case.

I have currently developed a project in Meteor JS and have (want) to use mongoDB with it. The site has an input field in which there is auto-complete.

((Only for Germany in my case)) The function should be like this:

You can enter your ZIP code and it will find autocomplete with the city in it. e.g. 10789 Berlin

You can also simply type β€œBerlin” on it or on the Street or, if you wish, the Browser Detection Position now.

At this time, I have a large database in MYSQL with millions of geodata. I have millions of addresses with a zip code, city, and GEO-Data. I want to use this to autocomplete data and find the GEO code after entering the address.

Now my question is how to create my MongoDB collection. All information in one collection? Or do I need to break it in many collections? for example 1 Collection for Zip codes, cities and streets (with street number?).

Something like that:

streets:
{
    streetname : 'Sandsteinweg',
    geocode : 'GEOCODE',
    zip : 12349
}

plz : {
    plz : 12349,
    geocode: 'GEOCODE',
    city : berlin

}

citys :
{
    name : Berlin,
    geocode : 'GEOCODE',
    bundesland : 'Berlin'
}

Are there any documents or input for a better way to do this?

By the way: I do not want to use external services. An external service is simply used when the street name is not in my collection, and I must add it with new geo-information that is not in my collection yet.

+4
1

MongoDB, , " " . , "auto-suggest" ( "auto-complete" ), " ".

, , , , , . , MongoDB , . "" .

, , "auto-suggest", GEO. "Geo" , .

, , : - , 2dSphere, . , "" , "GEO" .

, "", .

, , "" . , .

+3

Source: https://habr.com/ru/post/1532948/


All Articles