I want to know the benefits of embedding the data like phone number and email in separate contact key like
Schema 1
{
"name": "Shama",
"contact": {
"age": 18,
"grade": "A",
"school": "XYZ High School"
}
},
Schema 2
{
"name": "Shama",
"age": 18,
"grade": "A",
"school": "XYZ High School"
},
What is the benefits of object schema 1 before schema 2?
I have seen this schema many place while someone learn the data modelling of mongodb.
However the querying of schema is still easy as compared to schema 1, then why schema 1 is so popular. Please anyone put some light on it.
Image Schema 1
{
"_id": <ObjectId1>,
"username": "123xyz",
"phone": "1230456-7890",
"email": "xyz@example.com",
"level": 5,
"group": "dev"
},
Is Image Schema 1 is better or not