U
U
Urukhayy2018-05-18 09:59:24
MongoDB
Urukhayy, 2018-05-18 09:59:24

Is using relationships in Mongo OK?

Is it okay to use relationships in Mongo? For example, the Collection "group" contains an array of references ref "people" -- the people who are members of this group. How to be, is it better to embed people as a whole object or by reference? And another moment, if the collection "institution" should also refer to some "people", then here too by reference, or to embed the whole person here and there? But if you embed it entirely, then the difficulty is in synchronizing the relevance of a person’s data, suddenly the original person changes its fields, you will have to go over all the places where this person is and update his fields.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
Lander, 2018-05-18
@usdglander

Asking questions like this - are you sure that you need Mongo to take? Maybe it's better to do everything on relational databases?

O
OnYourLips, 2018-05-18
@OnYourLips

It looks like you have related data. Under such data it is worth using relational DBMS.
Mongo for other tasks (logging, etc.).

P
pcdesign, 2018-05-18
@pcdesign

You can use Mongo for related fields, but it's better not to reinvent the wheel, but to take a ready-made framework that can do this out of the box. For example, mongoengine for python.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question