I’m creating an e-commerce database for my degree thesis and I have some doubts about how to structure my user-employee-client collections. In this case I have a general entity of Users, that can be divided into Clients and Employees, but the entity of Employees is sectionalized into three departments ‘Administraor’, ‘Content Manager’ and ‘Support’. I have three possible options for this structure:
-
Creating the User collection and using a discriminator to divide Employee and Client creating those as User discriminator’s schemas, and creating the departments by referencing the employees id.
-
Creating the User collection schema, and the Client and Employee ones will be referencing the user ID in their schemas, but using discriminators in the employees departments.
-
Make every collection referencing the id’s of each collection.
Which option is better when talking about performance?
PD: Maybe an important fact is that is a comparational study between postgresql and mongodb, so idk if I’m thinking it too relational hahaha
Marivicks is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.