Join table equivalent in MongoDB


I am new to MongoDB so I am having a bit of trouble

In traditional relational databases, I would have a “join” table to create a one-to-many relationship which looks like this.


1 |
2 |
2 |
2 |
2 |

Hi @bradford_li,

Joins consider an antipattern in MongoDB and should be avoided as possible by embading documents as subdocuments and performing several lookup queries .

If for any reason joining collections is a must you can use $lookup or $graphLookup to perform this aggregation


1 Like