Answer the question
In order to leave comments, you need to log in
How to properly organize MongoDB architecture?
You need to design a database, tell me the right solution:
In my logic, I came to this solution:
MongoDB. The first collection is the same type of documents, each of which contains: gender, weight, height, age and a link to the clothes he is wearing. The second collection contains the documents referenced by the first: Type of clothing (t-shirt, jeans), its color and who refers to it.
How do I now organize the selection: Select all height values that refer to the blue pants.
I understand that SQL logic is suitable for solving this problem, the fact is that I greatly simplified the example for the question, in fact, in the first collection, the documents contain a large number of parameters and in some they are present and in some they are absent, for this purpose I chose Mongo and now the data is precisely grouped by parameters into another collection, it turned out very convenient, except for one BUT!
Answer the question
In order to leave comments, you need to log in
Never so.
You are doing what you would do with a relational DBMS like MySQL and so on.
There communications between tables are norm.
And Mongo handles them very badly.
It does denormalization.
Here I join grinat
If you already work with methods intended for relational DBMS, then:
UPDATED:
qovalenko ,
I understand you, the fact is that if you add the data of the second collection to the data of the first, then when updating this data, you will need to change them in several documents of the first collection, and this is not so convenient.
The first collection is the same type of documents, each of which contains: gender, weight, height, age and a link to the clothes he is wearing.Typical SQL table.
The second collection contains the documents referenced by the first: Type of clothing (t-shirt, jeans), its color and who refers to it.Typical SQL table.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question