Skip to main content

Interface: INoSqlAdapter

Defined in: src/nosql/INoSqlAdapter.ts:74

Universal interface for document-oriented (NoSQL) database adapters in entityTS.

Implemented by MongoDbAdapter, DynamoDbAdapter, CosmosDbAdapter, FirestoreAdapter, MockNoSqlAdapter.

Methods​

connect()​

connect(): Promise<void>

Defined in: src/nosql/INoSqlAdapter.ts:77

Returns​

Promise<void>


disconnect()​

disconnect(): Promise<void>

Defined in: src/nosql/INoSqlAdapter.ts:78

Returns​

Promise<void>


ping()​

ping(): Promise<boolean>

Defined in: src/nosql/INoSqlAdapter.ts:79

Returns​

Promise<boolean>


insertOne()​

insertOne<T>(collection, doc, options?): Promise<InsertOneResult>

Defined in: src/nosql/INoSqlAdapter.ts:81

Type Parameters​

Type ParameterDefault type
Tunknown

Parameters​

ParameterType
collectionstring
docT
options?InsertOptions

Returns​

Promise<InsertOneResult>


insertMany()​

insertMany<T>(collection, docs, options?): Promise<InsertManyResult>

Defined in: src/nosql/INoSqlAdapter.ts:86

Type Parameters​

Type ParameterDefault type
Tunknown

Parameters​

ParameterType
collectionstring
docsT[]
options?InsertOptions

Returns​

Promise<InsertManyResult>


find()​

find<T>(collection, filter?, options?): Promise<T[]>

Defined in: src/nosql/INoSqlAdapter.ts:92

Type Parameters​

Type ParameterDefault type
Tunknown

Parameters​

ParameterType
collectionstring
filter?NoSqlFilter
options?FindOptions

Returns​

Promise<T[]>


findOne()​

findOne<T>(collection, filter?, options?): Promise<T | null>

Defined in: src/nosql/INoSqlAdapter.ts:93

Type Parameters​

Type ParameterDefault type
Tunknown

Parameters​

ParameterType
collectionstring
filter?NoSqlFilter
options?Omit<FindOptions, "limit">

Returns​

Promise<T | null>


updateOne()​

updateOne(collection, filter, update, options?): Promise<UpdateResult>

Defined in: src/nosql/INoSqlAdapter.ts:99

Parameters​

ParameterType
collectionstring
filterNoSqlFilter
updateNoSqlUpdate
options?UpdateOptions

Returns​

Promise<UpdateResult>


updateMany()​

updateMany(collection, filter, update, options?): Promise<UpdateResult>

Defined in: src/nosql/INoSqlAdapter.ts:105

Parameters​

ParameterType
collectionstring
filterNoSqlFilter
updateNoSqlUpdate
options?UpdateOptions

Returns​

Promise<UpdateResult>


deleteOne()​

deleteOne(collection, filter, options?): Promise<DeleteResult>

Defined in: src/nosql/INoSqlAdapter.ts:112

Parameters​

ParameterType
collectionstring
filterNoSqlFilter
options?DeleteOptions

Returns​

Promise<DeleteResult>


deleteMany()​

deleteMany(collection, filter, options?): Promise<DeleteResult>

Defined in: src/nosql/INoSqlAdapter.ts:117

Parameters​

ParameterType
collectionstring
filterNoSqlFilter
options?DeleteOptions

Returns​

Promise<DeleteResult>


countDocuments()​

countDocuments(collection, filter?, options?): Promise<number>

Defined in: src/nosql/INoSqlAdapter.ts:123

Parameters​

ParameterType
collectionstring
filter?NoSqlFilter
options?CountOptions

Returns​

Promise<number>


aggregate()​

aggregate<T>(collection, pipeline, options?): Promise<T[]>

Defined in: src/nosql/INoSqlAdapter.ts:125

Type Parameters​

Type ParameterDefault type
Tunknown

Parameters​

ParameterType
collectionstring
pipelineAggregationStage[]
options?AggregateOptions

Returns​

Promise<T[]>


beginTransaction()?​

optional beginTransaction(): Promise<NoSqlTransaction>

Defined in: src/nosql/INoSqlAdapter.ts:131

Returns​

Promise<NoSqlTransaction>


executeStream()?​

optional executeStream<T>(collection, filter?, options?): AsyncIterable<T>

Defined in: src/nosql/INoSqlAdapter.ts:132

Type Parameters​

Type ParameterDefault type
Tunknown

Parameters​

ParameterType
collectionstring
filter?NoSqlFilter
options?FindOptions

Returns​

AsyncIterable<T>


getCollection()?​

optional getCollection<T>(name): T

Defined in: src/nosql/INoSqlAdapter.ts:137

Type Parameters​

Type ParameterDefault type
Tany

Parameters​

ParameterType
namestring

Returns​

T


createIndex()?​

optional createIndex(collection, keys, options?): Promise<string>

Defined in: src/nosql/INoSqlAdapter.ts:138

Parameters​

ParameterType
collectionstring
keysRecord<string, 1 | -1 | "text" | "2dsphere" | string>
options?{ unique?: boolean; name?: string; background?: boolean; ttl?: number; }
options.unique?boolean
options.name?string
options.background?boolean
options.ttl?number

Returns​

Promise<string>

Properties​

provider​

readonly provider: NoSqlProvider

Defined in: src/nosql/INoSqlAdapter.ts:75