Instance Methodswift-mongodb 0.27.0MongoTesting->Mongo
withTemporaryDatabase(_:run:)
Sets up a temporary database with the specified name, removing it after the closure argument returns. If a database with the specified name already exists, this function drops it before calling the closure.
Mongo.SessionPool (ext).swift:18nonisolated func withTemporaryDatabase(_ database: Mongo.Database, run body: (Mongo.SessionPool) async throws -> ()) async throws
It is good practice to give scratch databases names that start with an uppercase letter. To prevent accidental deletion of long-lived databases, this function always traps if the database name begins with a lowercase letter.