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

Please authenticate to join the conversation.

Upvoters
Status

Completed

Board
๐Ÿ› ๏ธ

Bug & Fixes

Date

11 months ago

Author

Ivan Ligotino

Subscribe to post

Get notified by email when there are changes.