Skip to content

SimpleMongoReader

Defined in: .build/typescript/packages/providers/storage/mongodb/src/readers/mongo.ts:8

Read in from MongoDB

  • BaseReader<Document>

new SimpleMongoReader(client): SimpleMongoReader

Defined in: .build/typescript/packages/providers/storage/mongodb/src/readers/mongo.ts:11

MongoClient

SimpleMongoReader

loadData<TSchema>(dbName, collectionName, fieldNames, separator, filterQuery, maxDocs, metadataNames?): Promise<Document<Metadata>[]>

Defined in: .build/typescript/packages/providers/storage/mongodb/src/readers/mongo.ts:40

Loads data from MongoDB collection

TSchema extends Document = Document

string

The name of the database to load.

string

The name of the collection to load.

string[] = ...

An array of field names to retrieve from each document. Defaults to [“text”].

string = ""

The separator to join multiple field values. Defaults to an empty string.

Filter<TSchema> = {}

Specific query, as specified by MongoDB NodeJS documentation.

number = 0

The maximum number of documents to retrieve. Defaults to 0 (retrieve all documents).

string[]

An optional array of metadata field names. If specified extracts this information as metadata.

Promise<Document<Metadata>[]>

If a field specified in fieldNames or metadataNames is not found in a MongoDB document.

BaseReader.loadData