Multilanguage enablement of existing collections

What would be a recommended approach to enable existing collections for multilanguage support?
The objects of these collections have several properties, some are relevant for translation, others aren’t.
CRUD operations are continuously performed on all collections.
Should the translation information be stored directly in the objects of the collection, or would it be better, to e.g. have a dedicated text collection, which is somehow joined?
A simple example would be very much appreciated

Hi @Christoph_Rohatsch,

Welcome to MongoDB community.

A common approach to this problem is storing an embedded document for each language for example:

{ word : 
    {  "en" : " hello", "fr" : "bonjour" ... }
}

Another approach better for searches can be the attribute pattern:

{ word : [ {"k" : "en" , v : "hello"}, {"k" : "fr" , v : "bonjour"}]}

Than index and query {word.k: 1 , word.v : 1}

Thank
Pavel

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.