Big collection with userid or small collections

Joined
Sep 14, 2022
Messages
4
Reaction score
0
Hello,

I want to dev an app with users, teachers, students, calendar, scheduler, etc... One user only can access to his own data, never can see other students or calendar of another user (except admin who can access to every data).

I dont know the best model for tthis app with mongodb. What is better:

1. Do every table as a little collection and put a userid key on every table

2. Do one big collection for every user and nested documents or collections for.every table.

What is the best options for a good scalable and performance?

Thanks, i hope u can gelp.me
 
Joined
Mar 28, 2022
Messages
82
Reaction score
11
Check out Normal Forms of table design; essentially there's two things that go into a table: The key column(s) that together uniquely identify a record, and the contents that depend exclusively on those key columns.

 
Joined
Sep 14, 2022
Messages
4
Reaction score
0
What? Yes, i understqnd normal forms but this not andwer my question, that i dont know what is better on my case
 
Joined
Mar 28, 2022
Messages
82
Reaction score
11
If a record in a column of information can be uniquely identified by using only userID, then it goes in one table keyed on userID.

For example, a person's date of birth; each userID has exactly one date of birth.
But not their children's userID -- that goes in a separate table because one user can have several children.

Users table
UserIDNameDate of Birth
1Mary1/1/2000
2Sue1/1/1980
3John1/1/2005
4Greg1/1/1984

Children table
Parent's UserIDChild's UserID
21
23

In this example Sue is a parent of both Mary and John, but not Greg
 
Last edited:
Joined
Sep 14, 2022
Messages
4
Reaction score
0
Uff, I'm so sorry for my english. It's so hard for me explain my problem in not native language.

I have users, users can access to his data, and his data are students, teachers, shceduler, calendar, ...

This means, every user have his own data, and this data it's for app tables.

I have a mongodb, no sql.

Thanks, I hope I explained better now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top