update mongo for multi db support

This commit is contained in:
Boki 2025-06-14 12:19:20 -04:00
parent 4942574b94
commit cbef304045
7 changed files with 927 additions and 13 deletions

View file

@ -27,3 +27,27 @@ export async function disconnectMongoDB(): Promise<void> {
await client.disconnect();
}
}
/**
* Set the default database for all operations
*/
export function setDefaultDatabase(databaseName: string): void {
const client = getMongoDBClient();
client.setDefaultDatabase(databaseName);
}
/**
* Get the current default database name
*/
export function getCurrentDatabase(): string {
const client = getMongoDBClient();
return client.getDefaultDatabase();
}
/**
* Get a database instance by name
*/
export function getDatabase(databaseName?: string) {
const client = getMongoDBClient();
return client.getDatabase(databaseName);
}