Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

299
Views
MERN stack MongoDB Permission and Access Level Setup

I am creating a MERN Stack application. I am very confused about access permission to keys in my mongoDb schemas. I came from Firebase which allowed you to set up node level read/write access controls in the Firebase rules. Below is an example I wish to achieve.

There are 3 Schemas:

UserSchema : {
id : id,
name : String ,
email : String 
}

CompanySchema : {
createdByID : ref : userSchema,
team : [ref : userSchema],
Id : id,
name : String,
description : String,
}

SubDivisionSchema : {
createdById : ref : userSchema ,
company : ref : CompanySchema ,
name : String ,
calendar : [Object]
}

The flow that occurs is that a Company hires Users. They then deploy these users to subdivisions. By default all new hires at a company are of role type Team. The owner of the company can elevate their permissions to one of the permission below.

OWNER , ADMIN , HR , TEAM

Below are what these permissions can do:

Owner : CRUD on Business and CRUD on all subdivisions

Admin : RU on Business and CRUD on all subdivisions

HR : All read and only allowed to update the team on Business and all R and only allowed to update calendar on all subdivisions

Team : Only read on some fields on Business. Only read on subdivision they are assigned to.

I will also have subdivision access levels but if I can just understand how to give key-level access control rather than document-level access control, I think I can work from there.

Thank you!

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!