I am creating a new database using Firestore. I am new to NoSQL and trying to determine best practices for modeling my data. I know that Firestore data is shallow by default (as opposed to the Realtime Database) so nesting isn't a problem. That said, what would be the best way to model a more-or-less standard user object?
Option 1 — Parent Level Only:
users {
uid {
name: 'Bob',
officeNumber: 1234567890,
faxNumber: 0987654321,
email: 'test@test.com',
domain: '@test.com',
facebook: 'bobdylan97',
twitter: 'bobbystwitter',
instagram: 'bobinsta',
street: '111 N Elm St',
city: 'Brooklyn',
state: 'NY',
zip: 12345,
height: 72,
weight: 200,
hairColor: 'brown',
eyeColor: 'blue'
}
}
Option 2 — Nest Multiple Levels:
users {
uid {
personal {
name {
first: 'Bob',
last: 'Dylan'
},
attributes {
height: 72,
weight: 200,
hairColor: 'brown',
eyeColor: 'blue'
}
},
contact {
phone {
office: 1234567890,
fax: 0987654321
},
email: 'test@test.com',
domain: '@test.com',
social {
facebook: 'bobdylan97',
twitter: 'bobbystwitter',
instagram: 'bobinsta'
}
},
address {
street: '111 N Elm St',
city: 'Brooklyn',
state: 'NY',
zip: 12345
}
}
}
The company I am building this for is growing and there may be additional data added at various points, so scaling is a potential concern. Are there any problems or concerns with grouping data like in Option 2? What is the best practice for modeling data like this? Is the best practice to optimize the model for querying or for organization?