Hi all. I’m new to databases in general. I have a Node+Express multiuser app with each user’s data and login credentials in mongodb Altas database.
So I thought of the following structure -
App Database
Accounts Collection - To store only username and password
Profile Collection - to store all other information related to the user
I don’t know how to relate one to another. one option I can see is to have username in both profile and account document for every user. Then I can check password using the account document and if successful, I would search the username in Profile collection and return the data in a response.
Or am I thinking too hard and I should just store both username, password, and profile data in one document for each user.
What’s the best practice?
Thx