I have to manage multilingual information in JSON documents in a MongoDB/Mongoose context. But I'm in a dilemma regarding best the format to use with a view to performance metrics:
I'm currently considering two formats (data is left empty):
// English translation in top level, and all of the others language are
// kept in a translation array
[
{
"_id": "",
"title": "",
"description": "",
"image": "",
"slug": "",
"content": "",
"translation": [
{
"language": "",
"title": "",
"description": "",
"content": ""
}
]
}
]
and:
// English translations is moved from the header to the array
// together with the translations for all the other languages
[
{
"_id": "",
"image": "",
"slug": "",
"translation": [
{
"language": "",
"title": "",
"description": "",
"content": ""
}
]
}
]
Which of the two approaches would be better from the point of view of the performance? Are there any better format patterns to use?