Add index to privileges collection
Create the following index:
db.privileges.createIndex(
{ userId: 1, resourceId: 1 }
)This index will speed up queries based on userId (i.e. retrieve all the privileges of a given user) and userId-resourceId (i.e. retrieve user privileges for specific resources).
Additionally, fix the method upsertPrivilege of PrivilegesRepository in order to leverage the new index

- Domain
- AuthN-Z
- Action
- fix
- Department
- Backend
Status: Completed
Log in to comment and vote
No comments yet
Be the first to share your thoughts.