Hi,
Just having a think about the Voting App backend project and the best way to layout the database. One option (Idea 1) would be to have the user and their polls in the same Mongo Collection, and Idea 2 would be to split the information into two collections; one for the users and one for the polls.
I’m not sure of the potential pros and cons of either of these really.
Any pearls of wisdom please on the best approach… maybe there’s another way?
Thanks,
Tim.
Idea 1
votingDb: [
{
username: string
email: string
password: hash? with auth plugin?
polls: [
{
username: string
pollName: string
pollOptions: [{'batman': 5}, {'He-Man': 0}]
}
]
}
]
Idea 2
users: [
{
username: string
email: string
password: hash? with auth plugin?
}
]
polls: [
{
username: string
pollName: string
pollOptions: [{'batman': 5}, {'He-Man': 0}]
}
]