Articles → MONGODB → One-On-One Relationships In Mongodb
One-On-One Relationships In Mongodb
As Embedded Document
{
"_id": ObjectId("6091d4cb4ccdbfb4cc7f8422"),
"name": "John Doe",
"email": "johndoe@gmail.com",
"address": {
"street": "123 Main St",
"city": "Anytown",
"state": "CA",
"zip": "12345"
}
}
As Referenced Document
{
"_id": ObjectId("6091d4cb4ccdbfb4cc7f8422"),
"name": "John Doe",
"email": "johndoe@gmail.com",
"address_id": ObjectId("6091d4cb4ccdbfb4cc7f8423")
}
{
"_id": ObjectId("6091d4cb4ccdbfb4cc7f8423"),
"street": "123 Main St",
"city": "Anytown",
"state": "CA",
"zip": "12345"
}