- A MongoDB server (local or online) running MongoDB 2.6 or above. (MongoDB 3.2 or 3.4 is recommmended)
- Swift 3.1 or greater
Linux requries the libssl-dev
library to be installed.
Install MongoDB for Ubuntu, macOS or any other supported Linux Distro.
Alternatively; make use of a DAAS (Database-as-a-service) like Atlas, MLab, Bluemix or any other of the many services.
Add this to your dependencies:
.Package(url: "https://github.com/vapor-community/MongoKitten-Provider.git", majorVersion: 0, minor: 1)
And import MongoKittenProvider
in your project.
After that you can add the MongoKittenProvider.Provider
to your list of providers.
try config.addProvider(MongoKittenProvider.Provider.self)
Your mongo.json
can stay the same with MongoKitten provider.
{
"url": "mongodb://localhost/my-database"
}
If you need the MongoDB database object:
try drop.assertMongoDB()
will get it.
Many articles on medium are listed here and here.
We host the MongoKitten documentation including dash docset here.