Join table equivalent in MongoDB

Hello,

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.

UUID | EMAIL

1 | test@gmail.com
2 | test2@gmail.com
2 | test2@gmail.com
2 | test2@gmail.com
2 | test2@gmail.com

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

Pavel

1 Like