1

I'm a building a registration form for my website and need to populate the country, state and city field. All these fields are inter-linked i.e depending on country, state field will be set and depending on state city will be set. I'm trying to figure out what's the best approach to model this using Neo4j. Do I need to create node for each country, state and city, and then create relationships between all of them. For instance, Detroit - belongs to - Michigan - belongs to - United States. What would be the best approach to handle this in Neo4j? Are there any examples to look at ? or is it better to use a document based DB for that such as MongoDB?

  • In the US, you can't define a unique city without also including the state attribute (e.g., Dallas Texas and Dallas Georgia). Other countries have differing requirements. Do you need to store cities that may have a country without a state? – Adam Zuckerman Jun 21 '16 at 0:26
  • I need to define cities that are unique based on state and country. So, selection process will be Country->State->City. You are right, other countries will have different requirements. For instance, Ireland doesn't have cities within states. It only has counties. Therefore, it will only have 2 things in selection Country -> Region. Therefore, I need to model a database that can best captures cities within countries. I'm using Neo4j for my project but I have no idea where to start in this case. – jas Jun 21 '16 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.