Skip to content
MongoDB driver for Fluent
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
Sources/MongoDriver
Tests group by id if no rawComputedFields are specified Oct 26, 2018
.gitignore .gitIgnore Package.pins Apr 14, 2017
Package.swift revert package.swift Oct 12, 2017
Package@swift-4.swift
README.md

README.md

Mongo Driver for Fluent

Swift Slack Status

Install the MongoDB server

For more instructions, check out https://docs.mongodb.com/master/administration/install-community/.

OS X

brew install mongodb

Ubuntu

sudo apt-get update
sudo apt-get install mongodb

Run the MongoDB server

mongod

Connecting to MongoDB with Fluent

You need to edit Config/fluent.json to define mongo as the underlying database technology to use as driver for Fluent:

{ 
    "driver": "mongo" 
}

Creating a driver is done using the MongoDB Connection String URI Format. Initializing a MongoDriver such a URI will attempt a connection to MongoDB.

import MongoDriver
import Fluent

let driver = try MongoDriver("mongodb://localhost")
let db = Fluent.Database(driver)
You can’t perform that action at this time.