lazyConnect(to:logger:)

Connect lazily to a MongoDB database using a connection string

MongoDatabase.swift:168
static func lazyConnect(to uri: String, logger: Logger = Logger(label: "org.orlandos-nl.mongokitten")) throws -> MongoDatabase

Parameters

uri

A MongoDB connection string (e.g. “mongodb://localhost/myapp”)

logger

Optional logger for database operations

Returns

A database instance that will connect lazily

Unlike connect, this method does not immediately establish a connection. The connection will be established when the first database operation is performed. This can be useful in development or testing scenarios where the database might not be immediately available.