Skip to content

ema / @internals/db / MongoConversationDB

Class: MongoConversationDB

Defined in: db/mongo.conversation.ts:13

MongoDB-based implementation of ConversationDB Stores conversation data in a MongoDB collection

Implements

Constructors

Constructor

ts
new MongoConversationDB(mongo): MongoConversationDB;

Defined in: db/mongo.conversation.ts:26

Creates a new MongoConversationDB instance

Parameters

mongo

Mongo

MongoDB instance to use for database operations

Returns

MongoConversationDB

Properties

collections

ts
collections: string[];

Defined in: db/mongo.conversation.ts:20

The collection names being accessed

Methods

deleteConversation()

ts
deleteConversation(id): Promise<boolean>;

Defined in: db/mongo.conversation.ts:92

Deletes a conversation from the database

Parameters

id

number

The unique identifier for the conversation to delete

Returns

Promise<boolean>

Promise resolving to true if deleted, false if not found

Implementation of

ConversationDB.deleteConversation


getConversation()

ts
getConversation(id): Promise<ConversationEntity | null>;

Defined in: db/mongo.conversation.ts:64

Gets a specific conversation by ID

Parameters

id

number

The unique identifier for the conversation

Returns

Promise<ConversationEntity | null>

Promise resolving to the conversation data or null if not found

Implementation of

ConversationDB.getConversation


listConversations()

ts
listConversations(req): Promise<ConversationEntity[]>;

Defined in: db/mongo.conversation.ts:35

Lists conversations in the database

Parameters

req

ListConversationsRequest

The request to list conversations

Returns

Promise<ConversationEntity[]>

Promise resolving to an array of conversation data

Implementation of

ConversationDB.listConversations


upsertConversation()

ts
upsertConversation(entity): Promise<number>;

Defined in: db/mongo.conversation.ts:82

Inserts or updates a conversation in the database

Parameters

entity

ConversationEntity

The conversation data to upsert

Returns

Promise<number>

Promise resolving to the ID of the created or updated conversation

Implementation of

ConversationDB.upsertConversation