Static Methodmongokitten 7.9.5MongoKitten
connect(to:logger:)
Connect to the database with the given settings. You can also use connect(_:on:)
to connect by using a connection string.
static func connect(to settings: ConnectionSettings, logger: Logger = Logger(label: "org.orlandos-nl.mongokitten")) async throws -> MongoDatabase
Parameters
- settings
The connection settings, which must include a database name
Will postpone queries until initial discovery is complete. Since the cluster is lazily initialized, you’ll only know of a failure in connecting (such as wrong credentials) during queries
Other members in extension
Type members
static func connect(to: String, logger: Logger
) async throws -> MongoDatabase Connect to the database at the given
uri
usingMongoCluster
static func lazyConnect(to: ConnectionSettings, logger: Logger
) throws -> MongoDatabase Connect to the database with the given settings lazily. You can also use
lazyConnect(_:on:)
to connect by using a connection string.static func lazyConnect(to: String, logger: Logger
) throws -> MongoDatabase Connect to the database at the given
uri
usingMongoCluster
Instance members
var activeTransaction: MongoTransaction?
var commandNamespace: MongoNamespace
The collection to execute commands on
var isInTransaction: Bool
var logMetadata: Logger.Metadata?
var logger: Logger
let name: String
The name of the database
let pool: MongoConnectionPool
let session: MongoClientSession?
var sessionId: SessionIdentifier?
subscript(String
) -> MongoCollection Get a
MongoCollection
by providing a collection name as aString
func adoptingLogMetadata(Logger.Metadata
) -> MongoDatabase func drop(
) async throws Drops the current database, deleting the associated data files
func listCollections(
) async throws -> [MongoCollection] Lists all collections your user has knowledge of
func startTransaction(autoCommitChanges: Bool, with: MongoSessionOptions, transactionOptions: MongoTransactionOptions?
) async throws -> MongoTransactionDatabase Creates a new tranasction provided the SessionOptions and optional TransactionOptions