Application
extension Application
An extension to Vapor’s Application
type to add support for configuring your application to interact with a
MongoDB deployment. All of the API is namespaced under the .mongoDB
property on the Application.MongoDB
type.
This extension supports the following:
Configuring a global MongoDB client for your application via
Application.MongoDB.configure(_:options:)
, for example:myApp.mongoDB.configure("mongodb://localhost:27017")
Accessing a global client via
Application.MongoDB.client
, for example:myApp.mongoDB.client.listDatabases()
Cleaning up the global client when your application is shutting down via
Application.MongoDB.cleanup()
, for example:myApp.mongDB.cleanup()
See Application.MongoDB
for further details.