Logo
Classes

MongoDocumentStore

Defined in: packages/providers/storage/mongodb/src/docStore/MongoDBDocumentStore.ts:13

Extends

  • KVDocumentStore

Constructors

Constructor

new MongoDocumentStore(__namedParameters): MongoDocumentStore

Defined in: packages/providers/storage/mongodb/src/docStore/MongoDBDocumentStore.ts:14

Parameters

__namedParameters

MongoDBDocumentStoreConfig

Returns

MongoDocumentStore

Overrides

KVDocumentStore.constructor

Methods

fromMongoClient()

static fromMongoClient(mongoClient, dbName, collectionName): MongoDocumentStore

Defined in: packages/providers/storage/mongodb/src/docStore/MongoDBDocumentStore.ts:30

Static method for creating an instance using a MongoClient.

Parameters

mongoClient

MongoClient

MongoClient instance

dbName

string = DEFAULT_DATABASE

Database name

collectionName

string = DEFAULT_COLLECTION

Collection name

Returns

MongoDocumentStore

Instance of MongoDBDocumentStore

Example

const mongoClient = new MongoClient("mongodb://localhost:27017");
const documentStore = MongoDBDocumentStore.fromMongoClient(mongoClient, "my_db", "my_collection");

fromConnectionString()

static fromConnectionString(connectionString, dbName, collectionName): MongoDocumentStore

Defined in: packages/providers/storage/mongodb/src/docStore/MongoDBDocumentStore.ts:57

Static method for creating an instance using a connection string.

Parameters

connectionString

string

MongoDB connection string

dbName

string = DEFAULT_DATABASE

Database name

collectionName

string = DEFAULT_COLLECTION

Collection name

Returns

MongoDocumentStore

Instance of MongoDBDocumentStore

Example

const documentStore = MongoDBDocumentStore.fromConnectionString("mongodb://localhost:27017", "my_db", "my_collection");

On this page