Constructors
constructor
Type parameters
Parameters
Accessors
session
- get session(): ClientSession
Methods
delete
- delete(key: string): Promise<DeleteResult>
Parameters
Returns Promise<DeleteResult>
deleteAll
- deleteAll(): Promise<DeleteResult>
Returns Promise<DeleteResult>
get
- get(key: string): Promise<null | Doc<T>>
Parameters
Returns Promise<null | Doc<T>>
index
- index(indexSpec: { data?: IndexDirection | { [ K in string | number | symbol]: IndexDirection }; key?: IndexDirection }, options?: CreateIndexesOptions): Promise<void>
Parameters
indexSpec: { data?: IndexDirection | { [ K in string | number | symbol]: IndexDirection }; key?: IndexDirection }
Optional data?: IndexDirection | { [ K in string | number | symbol]: IndexDirection }
Optional key?: IndexDirection
Optional options: CreateIndexesOptions
Returns Promise<void>
match
- match(matcher: RegExp): Promise<Cursor<T>>
Parameters
Returns Promise<Cursor<T>>
query
Parameters
Returns Query<T>
set
- set(key: string, value: T): Promise<UpdateResult>
Parameters
Returns Promise<UpdateResult>
Static abortTransaction
- abortTransaction(client: MongoClient): Promise<void>
Parameters
Returns Promise<void>
Static commitTransaction
- commitTransaction(client: MongoClient): Promise<void>
Parameters
Returns Promise<void>
Static startTransaction
- startTransaction(client: MongoClient, options?: TransactionOptions): Promise<void>
Parameters
client: MongoClient
Optional options: TransactionOptions
Returns Promise<void>
A wrapper of mongo class for transaction