Appearance
ema / @internals/db / MongoRoleDB
Class: MongoRoleDB
Defined in: db/mongo.role.ts:9
MongoDB-based implementation of RoleDB Stores role data in a MongoDB collection
Implements
Constructors
Constructor
ts
new MongoRoleDB(mongo): MongoRoleDB;Defined in: db/mongo.role.ts:22
Creates a new MongoRoleDB instance
Parameters
mongo
MongoDB instance to use for database operations
Returns
MongoRoleDB
Properties
collections
ts
collections: string[];Defined in: db/mongo.role.ts:16
The collection names being accessed
Methods
deleteRole()
ts
deleteRole(id): Promise<boolean>;Defined in: db/mongo.role.ts:76
Deletes a role from the database
Parameters
id
number
The unique identifier for the role to delete
Returns
Promise<boolean>
Promise resolving to true if deleted, false if not found
Implementation of
getRole()
ts
getRole(id): Promise<RoleEntity | null>;Defined in: db/mongo.role.ts:42
Gets a specific role by ID
Parameters
id
number
The unique identifier for the role
Returns
Promise<RoleEntity | null>
Promise resolving to the role data or null if not found
Implementation of
listRoles()
ts
listRoles(): Promise<RoleEntity[]>;Defined in: db/mongo.role.ts:30
Lists all roles in the database
Returns
Promise<RoleEntity[]>
Promise resolving to an array of role data
Implementation of
upsertRole()
ts
upsertRole(entity): Promise<number>;Defined in: db/mongo.role.ts:62
Inserts or updates a role in the database If the role doesn't have an ID, a new one is generated
Parameters
entity
The role data to upsert
Returns
Promise<number>
Promise resolving to the ID of the created or updated role
Throws
Error if name, description, or prompt are missing