Appearance
ema / @internals/db / Mongo
Abstract Class: Mongo
Defined in: db/mongo.ts:49
A mongo database instance
Constructors
Constructor
ts
new Mongo(dbName): Mongo;Defined in: db/mongo.ts:52
Parameters
dbName
string
Returns
Mongo
Properties
dbName
ts
protected readonly dbName: string;Defined in: db/mongo.ts:52
isSnapshotSupported
ts
abstract readonly isSnapshotSupported: boolean;Defined in: db/mongo.ts:50
Methods
close()
ts
abstract close(): Promise<void>;Defined in: db/mongo.ts:79
Closes the MongoDB connection
Returns
Promise<void>
Promise resolving when connection is closed
connect()
ts
abstract connect(): Promise<void>;Defined in: db/mongo.ts:73
Connects to the MongoDB database
Returns
Promise<void>
Promise resolving when connection is established
getClient()
ts
abstract getClient(): MongoClient;Defined in: db/mongo.ts:67
Gets the MongoDB client instance
Returns
MongoClient
The MongoDB client instance
getDb()
ts
getDb(): Db;Defined in: db/mongo.ts:59
Gets the MongoDB database instance
Returns
Db
The MongoDB database instance
Throws
Error if not connected
restoreFromSnapshot()
ts
restoreFromSnapshot(snapshotData): Promise<void>;Defined in: db/mongo.ts:103
Restores the MongoDB database from the snapshot data.
Parameters
snapshotData
unknown
The snapshot data
Returns
Promise<void>
Promise resolving when the restore is complete
snapshot()
ts
snapshot(collections): Promise<unknown>;Defined in: db/mongo.ts:86
Takes a snapshot of the collections and returns the snapshot data.
Parameters
collections
string[]
The collection names to snapshot
Returns
Promise<unknown>
The snapshot data