SimpleMongoReader
Defined in: .build/typescript/packages/providers/storage/mongodb/src/readers/mongo.ts:8
Read in from MongoDB
Implements
Section titled “Implements”BaseReader
<Document
>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SimpleMongoReader(
client
):SimpleMongoReader
Defined in: .build/typescript/packages/providers/storage/mongodb/src/readers/mongo.ts:11
Parameters
Section titled “Parameters”client
Section titled “client”MongoClient
Returns
Section titled “Returns”SimpleMongoReader
Methods
Section titled “Methods”loadData()
Section titled “loadData()”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
Type Parameters
Section titled “Type Parameters”TSchema
Section titled “TSchema”TSchema
extends Document
= Document
Parameters
Section titled “Parameters”dbName
Section titled “dbName”string
The name of the database to load.
collectionName
Section titled “collectionName”string
The name of the collection to load.
fieldNames
Section titled “fieldNames”string
[] = ...
An array of field names to retrieve from each document. Defaults to [“text”].
separator
Section titled “separator”string
= ""
The separator to join multiple field values. Defaults to an empty string.
filterQuery
Section titled “filterQuery”Filter
<TSchema
> = {}
Specific query, as specified by MongoDB NodeJS documentation.
maxDocs
Section titled “maxDocs”number
= 0
The maximum number of documents to retrieve. Defaults to 0 (retrieve all documents).
metadataNames?
Section titled “metadataNames?”string
[]
An optional array of metadata field names. If specified extracts this information as metadata.
Returns
Section titled “Returns”Promise
<Document
<Metadata
>[]>
Throws
Section titled “Throws”If a field specified in fieldNames or metadataNames is not found in a MongoDB document.
Implementation of
Section titled “Implementation of”BaseReader.loadData