Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

415
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda