Connecting with MongoDB

Connecting with MongoDB is as simple as adding a MongoDB database provider to our Vapor application and telling Fluent to use mongodb as the database driver. A database driver allows an application to connect to the database and act as an adapter, which lets Fluent use a standard API to connect with different types of databases. The Fluent module also includes a memory and SQLite database driver and the API template defaults to using the in-memory database driver. We need to update this to start using the mongodb driver, so that we can connect with the mongodb server running locally on our machine.

The following is a table listing some of the popular databases that are supported, along with the config value for the ...

Get Hands-On Full-Stack Development with Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.