How to manage a DB with collections with different fields

Hi Joe.

The main problem i have now is when doing a signin: Should i use a transaction to insert into the User’s collection and the subtype collection? The id’s of User and Subtypes (student, teacher and admin) should be the same or should be different and refere to the User’s collection and if they are different, in the case of managing a JWT that keep the user’s id how would be the best way to identify if the user has the rights to Insert/Delete/Update one document (for instance, one student shouldn’t modify the data of another student).

In student we have one _id, in subtypes another (or not?) and maybe in another collections another more _id. Ufff! I am new with Mongo and i have overwhelmed :frowning:

And of course, in the Front (Angular) i want to keep independence of User’s guard.

Yeah, the main problem is with my backend in Mongo to connect well with front-end.

1 Like