Imagine that I’m storing a person’s phone numbers in JSON format. One such JSON entry might look like this:
{ "firstName": "John", "lastName": "Smith", "phoneNumber": [ { "type": "home", "number": "212 555-1234" }, { "type": "mobile", "number": "646 555-4567" } ] }
One alternative structure above:
{ "firstName": "John", "lastName": "Smith", "homePhone": { "number": "212 555-1234" }, "mobilePhone": { "number": "646 555-4567" } }
What are the pros and cons of the two modeling approaches? Obviously, I see that the first approach allows you to get all the phones in one go.
Steve source share