MongoDB for multi user data

0

I'm developing an application to the best ERP style, but much simpler. It is a MEAN (MongoDB, Express, Angular 2 and NodeJS) program and also has an Android version made with Ionic 2. It is still in development, but is already fully usable.

For this application, as I said before, I used the MongoDB database. In addition, in my opinion, it is easier and faster to develop and it marries perfectly with NodeJS and Angular later.

The database can easily be summarized in 6 tables (collections) where each of them has an average of 5 fields. Nothing too big or too complicated. With this DB 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 registered data.

I'd like to know how to mount this database with MongoDB, I have no idea how to do it. I just thought of adding to each document in the collection an ID to identify who the Group belongs to, and so at the time of the search, get the user's data (which is inside the Group) that requested it and make a filter .



Some information about the project:

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

  • Normal: Only access the data, not manipulate it. You only see the data for your group (and it has only one group);
  • Administrator: Accesses and manipulates data. You only have access to your group's data (and each group may have more than one administrator, and each Adm. Also has only one group).
  • Number of groups: The estimate is that it may have 500 groups;

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


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

    
asked by anonymous 07.04.2017 / 22:06

1 answer

1

Paul, I'll bring the recommendation I put in the answer to that question here :

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

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

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

    
13.05.2017 / 20:27