Swiftpack.co - Package - vapor-community/mongo-driver

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)

Github

link
Stars: 24
Help us keep the lights on

Used By

Total: 0

Releases

2.3.1 - Oct 26, 2018

Fixes:

  • When using distinct with no projection (computed fields), the driver falls back to filtering by document ID instead of collapsing all documents into one. #58

2.3.0 - Oct 26, 2018

This release adds support for distinct queries and projecting query results via the computed fields feature.

Caveat: both these new features behave differently than the SQL drivers. Check the tests for what to expect.

2.2.2 - Oct 24, 2018

This release fixes an issue which caused nested arrays to be serialized as empty subdocuments #56.

2.2.1 - Oct 17, 2017

  • Support outer joins

2.2.0 - Oct 12, 2017

  • Swift 4.0 package description
  • More aggregate types
    • min
    • max
    • sum
    • average
  • Queries with multiple joins
  • Queries on siblings
  • Bulk updates and deletes based with filters (also on joins)