Answer the question
In order to leave comments, you need to log in
Design: How to make a one-to-one relationship within the same entity?
Hello! There is such a "problem".
There is a ready-made MongoDB collection and it has one entity: “items”.
3 attributes/fields: id, title(string), content(array).
The bottom line is that some items are made up of other items (they themselves cannot be classified according to any particular attribute). And this data must be stored somewhere and somehow, for example:
There is an item with id:1 an item with id:2. In order to get an item id: 3, you need to take an item with id: 1 in the amount of 3, and an item with id: 2 in the amount of 4.
id_1-(3)->Id_4
Id_2-(4)->Id_4
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question