Mongodb for multi-user data

Asked

Viewed 251 times

0

I am developing an application to the best ERP style, but much simpler. It is a program of type MEAN (Mongodb, Express, Angular 2 and Nodejs) and also has a version for Android made with Ionic 2. It is still in development, but it is already fully usable.

For this application, as stated earlier, I used the Mongodb database. Besides, in my opinion, being easier and faster to develop and he marries perfectly with Nodejs and Angular later.

The database is easily summarized in 6 tables (collections) where each of them has an average of 5 fields. Nothing too big or too complicated. With this BD I am storing the data for a Group in the system. But the idea is to expand it and allow the creation of several Groups, where in each Group there are several users in the system, and each Group will obviously have their respective data registered.

I’d like to know how to build that database with Mongodb, I have no idea how to do it. I just thought to add to each document of the collection an ID to identify who is the Group that the data belongs to, and so, in the memento of the search, take the user’s data (which is within the in Group) who requested it and make a filter.



Some information about the project:

  • It is web-based and also has an app for Android (so far);
  • There are 2 types of user:

  • Normal: Only access the data, not manipulate it. Only see the data referring to your group (and have only one group);
  • Administrator: Access and manipulate the data. You only have access to your group’s data (and each group can have more than one administrator, and each Adm. also has only one group).

  • Number of groups: The estimate is that it can reach 500 groups;

  • Number of Normal Users: One for each group only;
  • Administrative user number: One or more for each group (no limits).

  • I would like a tip from you! Should I change banks?! Thank you!

    1 answer

    1

    Paul, I will bring the recommendation I put in the answer to this question here:

    Always think about how data will be accessed/entered/updated.

    Unlike relational databases, which are agnostic regarding who and how the data will be accessed, for applications using Mongodb this makes all the difference.

    Also remember what you’re giving up by choosing Mongodb: referential integrity, joins... is this important to your application? or schema flexibility, scalability are more important?

    Browser other questions tagged

    You are not signed in. Login or sign up in order to post.