-3

We want to design mongodb such that it can store data in multiple language.

We want to store person's info like name, gender, city, state, etc in english as well in arabic.

What is the best way to do so?

  • Possible dupe of http://stackoverflow.com/questions/29716619/best-way-to-represent-multilingual-database-on-mongodb or http://stackoverflow.com/questions/21653526/multi-language-attributes-in-mongodb – chridam Dec 02 '16 at 09:28

1 Answers1

1

It's very dependent on your usage of the data, If you're going to be using both language at the same time I'd store that all in one document per person.

person = {
   englishName : "English Name",
   arabicName : "Arabic Name",
   address: {
      city: "city",
      ...
   }
}

However you could store it in separate documents but in the same collection:

person = {
   culture: "en"
   name : "English Name",

   address: {
      city: "city",
      ...
   }
}

person = {
   culture: "ar"
   name : "Arabic Name",

   address: {
      city: "city",
      ...
   }

As I said it very dependant on how your application is going to work, but try to limit cross document joins.

Kevin Smith
  • 13,746
  • 4
  • 52
  • 77