Skip to content

reaumur/MongoKitten

Repository files navigation

Please leave a star to show your support for the project.

Swift 3.1.0 License Build Status

MongoKitten

OpenKitten

MongoKitten is a native, production-ready MongoDB driver written in pure Swift. It is the fastest MongoDB driver available on any platform, while providing a great Swift API that is a joy to use.

Core features

  • Production ready
  • No complex setup procedure, just import and go
  • Extremely performant 🚀
  • Pure Swift
  • Great API
  • Fast with support for new MongoDB and Swift features and versions

Requirements

  • 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.

Setting up MongoDB

Install MongoDB for Ubuntu, macOS or any other supported Linux Distro.

Alternatively; make use of a DAAS (Database-as-a-service) like Atlas, MLab, IBM Cloud or any other of the many services.

Getting started

Add MongoKitten to your Package.swift:

Swift 3: .Package(url: "https://github.com/OpenKitten/MongoKitten.git", majorVersion: 4)

Swift 4: .package(url: "https://github.com/OpenKitten/MongoKitten.git", from: "4.0.0")

For Swift 4 you also need to add MongoKitten to your target's dependencies and optionally ExtendedJSON for people using that:

.target(name: "MyTarget", dependencies: ["MongoKitten"])

After a swift package update, you can now use MongoKitten:

import MongoKitten

let myDatabase = try MongoKitten.Database("mongodb://localhost/my_database")
let myCollection = myDatabase["my_collection"]

for document in try myCollection.find("foo" > 42) {
    // do something with document
}

For more information on how to use MongoKitten, visit the documentation.

Building for performance

Always compile MongoKitten in release mode for production and benchmarks. MongoKitten has proven to be 100-200x faster on release mode compared to debug compilation. Both Xcode and SPM use debug compilation by default.

swift build -c release

Learn

Many articles on medium are listed here and here.

We host the MongoKitten documentation including dash docset here.

Community

Join our slack here and become a part of the welcoming community.

Learn more about contributing here.

Contributors are always welcome. Questions can be discussed on slack or in github issues. We also take part in the Contributor Covenant Code of Conduct.

Support

We're accepting donations for our project here. We hope to set up a good test environment as well as many docs, tutorials and examples.

Performance

MongoKitten is faster than other MongoDB drivers.

Driver Execution time
MongoKitten 4 525ms
Java (post JIT optimizations) 585ms
C 605ms
Ruby 1200ms
Java (pre JIT optimizations) 1205ms

License

MongoKitten is licensed under the MIT license.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages