How can you achieve primary key - foreign key relationships in MongoDB?

There are two ways to achieve the One-to-Many (primary key - foreign key) relationships in MongoDB.

1. Model One-to-Many Relationships with Embedded Documents A data model can use embedded documents to describe a one-to-many relationship between connected data. Embedding connected data in a single document can reduce the number of read operations required to obtain data.

2. Model One-to-Many Relationships with Document References A data model can use references between documents to describe one-to-many relationships between connected data.

Sources:

Model One-to-Many Relationships With Embedded Documents — MongoDB Manual. mongodb.com/docs/manual/tutorial/model-embe...

Model One-to-Many Relationships With Document References — MongoDB Manual. mongodb.com/docs/manual/tutorial/model-refe...