C
C
Coder3212017-08-12 01:38:58
MongoDB
Coder321, 2017-08-12 01:38:58

How to properly implement many to many relationship in mongodb?

How to properly implement many to many relationship in mongodb? Write an array of IDs to the model or through a link table? How would it be more correct?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Artur Aralin, 2017-08-12
@ArturAralin

As such, there are no relationships in mongodb, because the database is not relational.
As an example, here is a solution for you https://stackoverflow.com/questions/2336700/mongod...
If you want to do everything in one request, then read here, you may find that https://docs.mongodb.com/manual/ aggregation/

O
oh, 2017-09-04
well @AnneSmith

yes, by the way, any connection options are decided by roles
, only the question of managing these roles arises, but this is all a matter of conventions

P
Pavel Ivanov, 2017-09-04
@eastywest

If there is a need for many-to-many relationships, then you should look towards relational databases. Monga is not the best solution in this case.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question