S
S
Sergey2015-06-28 09:11:18
MongoDB
Sergey, 2015-06-28 09:11:18

Why don't you explain again about MEAN?

Question 1
Storing data in MongoDB
We have a Product collection consisting of data from several other collections:
Conditions -> Product <- Colors
Each document in the Conditions and Colors collections is just a name, but in different languages

{
    "_id" : "557e90f5096e2cb81d59fc09",
    "name" : {
        "ru" : "Старый",
        "en" : "Old"
    },
    "__v" : 0
},

The data in the Product from the Conditions and Colors collections, I want to save in a denormalized form, i.e. just save it there
{ {"name" : { "ru":"Старый, "en": "old"}, {"name" : {"ru": "новый", "en":"new"}}
, but there is nothing permanent and sometimes the composition of the Product will still need to be changed in the admin panel, depending on changes in other collections, i.e., if I want to change "old" to "Not quite old" in Conditions - I want it to change and in Product. How to implement it? Store in product and ._id from Conditions and query "When we change name in Conditions, then we search through all collections where there is the same ._id and change it to a new one"?
Question 2
Languages ​​in Angular.js
Is it possible to declare an array of possible languages ​​​​(ru, en, de, fr) at the beginning of the application settings, so that later in the forms you can do something like:
<div ng-repeat="language in languages track by $index">
         <input ng-model="name.{{language}}">                        
 </div>
?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Tartmin, 2015-06-28
@baskerville42

If I understood correctly what you need, then you would take the angular-translate library and just store the translations separately without changing the meaning of all words in all collections. And then it comes out very cold.

S
scapp, 2015-06-28
@scapp

If you want cascade update, you should have chosen a relational database.
Regarding question #2 - use constants.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question