I want to save multilingual data in my database. In Django, I was using django-transmeta and I could save and access the multilingual data easily.
In Mongoose, how I should save the data, or which modules should I use to to this?
For example, I want to save the names of an item in 3 languages:
In db, should it be:
{
name : {
en : 'Car',
tr : 'Araba',
es : 'Coche'
}
}
Yes you are right...
That is one way of doing it:
{
_id
name : {
en : 'Car',
tr : 'Araba',
es : 'Coche'
}
}
Another is:
{
YourId:'1'
locale: 'en',
name: 'Car'
}
{
YourId:'1'
locale: 'tr',
name: 'Araba'
}
{
YourId:'1'
locale: 'es',
name: 'Coche'
}
And in the 2nd example, its good to index 'YourId' & 'locale'