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