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

DomainAuthN-Z
Actionfix
DepartmentBackend

Please authenticate to join the conversation.

Upvoters
Status

Completed

Board
🛠️

Bug & Fixes

Date

Over 1 year ago

Author

Ivan Ligotino

Subscribe to request

Get notified by email when there are changes.