Appearance
ema / @internals/db / MongoShortTermMemoryDB
Class: MongoShortTermMemoryDB
Defined in: packages/ema/src/db/mongo.short_term_memory.ts:13
MongoDB-based implementation of ShortTermMemoryDB Stores short term memory data in a MongoDB collection
Implements
Constructors
Constructor
ts
new MongoShortTermMemoryDB(mongo): MongoShortTermMemoryDB;Defined in: packages/ema/src/db/mongo.short_term_memory.ts:26
Creates a new MongoShortTermMemoryDB instance
Parameters
mongo
MongoDB instance to use for database operations
Returns
MongoShortTermMemoryDB
Properties
collections
ts
collections: string[];Defined in: packages/ema/src/db/mongo.short_term_memory.ts:20
The collection names being accessed
Methods
appendShortTermMemory()
ts
appendShortTermMemory(entity): Promise<number>;Defined in: packages/ema/src/db/mongo.short_term_memory.ts:77
Appends a short term memory to the database
Parameters
entity
The short term memory to append
Returns
Promise<number>
Promise resolving to the ID of the created memory
Implementation of
ShortTermMemoryDB.appendShortTermMemory
createIndices()
ts
createIndices(): Promise<void>;Defined in: packages/ema/src/db/mongo.short_term_memory.ts:97
Creates indices for the short term memories collection.
Returns
Promise<void>
Promise resolving when indices are created.
deleteShortTermMemory()
ts
deleteShortTermMemory(id): Promise<boolean>;Defined in: packages/ema/src/db/mongo.short_term_memory.ts:89
Deletes a short term memory from the database
Parameters
id
number
The unique identifier for the short term memory to delete
Returns
Promise<boolean>
Promise resolving to true if deleted, false if not found
Implementation of
ShortTermMemoryDB.deleteShortTermMemory
listShortTermMemories()
ts
listShortTermMemories(req): Promise<ShortTermMemoryEntity[]>;Defined in: packages/ema/src/db/mongo.short_term_memory.ts:35
Lists short term memories in the database
Parameters
req
The request to list short term memories
Returns
Promise<ShortTermMemoryEntity[]>
Promise resolving to an array of short term memory data