Class that extends the BaseStore class to interact with a MongoDB database. It provides methods for getting, setting, and deleting data, as well as yielding keys from the database.

Example


Hierarchy (view full)

Constructors

Properties

collection: Collection<Document>
primaryKey: string = "_id"
yieldKeysScanBatchSize: number = 1000
namespace?: string

Methods

  • Deletes multiple keys from the MongoDB database.

    Parameters

    • keys: string[]

      Array of keys to be deleted.

    Returns Promise<void>

    Promise that resolves when all keys have been deleted.

  • Gets multiple keys from the MongoDB database.

    Parameters

    • keys: string[]

      Array of keys to be retrieved.

    Returns Promise<any[]>

    An array of retrieved values.

  • Sets multiple keys in the MongoDB database.

    Parameters

    • keyValuePairs: [string, DocumentInterface][]

      Array of key-value pairs to be set.

    Returns Promise<void>

    Promise that resolves when all keys have been set.

  • Yields keys from the MongoDB database.

    Parameters

    • Optional prefix: string

      Optional prefix to filter the keys. A wildcard (*) is always appended to the end.

    Returns AsyncGenerator<string, any, unknown>

    An AsyncGenerator that yields keys from the MongoDB database.

Generated using TypeDoc