Git Product home page Git Product logo

mongo-provider's Introduction

Mongo

Mongo Provider

Swift CircleCI Slack Status

⬇ Install Mongo

OS X

brew install mongo

Linux

sudo apt-get update
sudo apt-get install mongo

Run

mongod

📦 Add Provider

Now to use Mongo in your Vapor project.

Package

Add the package to your Package.swift.

.Package(url: "https://github.com/vapor/mongo-provider.git", majorVersion: 1, minor: 1)

Droplet

Add the provider to your Droplet.

import Vapor
import VaporMongo

let drop = Droplet()
try drop.addProvider(VaporMongo.Provider.self)

Note: If on Xcode you get a No such module ‘VaporMongo’ error, do a vapor xcode command. If that still doesn’t work do a vapor clean && vapor xcode command.

Config

Then add a mongo.json to your Config folder. You can add it in the root or keep it out of git in the secrets folder.

Config/
  - mongo.json
    secrets/
      - mongo.json

The secrets folder is under the .gitignore and shouldn't be committed.

Here's an example secrets/mongo.json

{
  "user": "username",
  "password": "badpassword",
  "database": "databasename",
  "port": "27017",
  "host": "z99a0.asdf8c8cx.us-east-1.rds.amazonaws.com"
}

Note: port and host are optional.

Manual

You can also manually configure the provider in code. This will bypass the configuration files.

import Vapor
import VaporMongo

let drop = Droplet()

let mongo = try VaporMongo.Provider(database: ..., user: ..., password: ...)
drop.addProvider(mongo)

📖 Documentation

Visit the Vapor web framework's documentation for more instructions on how to use this package.

💧 Community

Join the welcoming community of fellow Vapor developers in slack.

🔧 Compatibility

This package has been tested on macOS and Ubuntu.

mongo-provider's People

Contributors

honghaoz avatar islandjoe avatar plummer avatar tanner0101 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.