No commit activity in last 3 years
No release in over 3 years
A simple wrapper for instantiating a MongoDB connection in Sinatra
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.0
>= 1.0
>= 1.0
 Project Readme

Sinatra-Mongo-Config

A simple wrapper for instantiating a MongoDB connection in Sinatra

Installing

gem install sinatra-mongo-config

Usage

Set some properties so that a connection can be made to your MongoDB database. You then have access to a database object which represents your MongoDB database.

The complete list of parameters is:

:mongo_db
:mongo_host
:mongo_port
:mongo_user
:mongo_password

The only property you really need to set is mongo_db, everything else has sensible defaults for development.

Example

configure do
    set :mongo_db, 'ethangunderson'
end

configure :production do
    set :mongo_host, 'flame.local.mongohq.com'
    set :mongo_user, 'foo'
    set :mongo_password, 'bar'
end

get '/blog' do
    @posts = database['posts'].find()
    haml :blog
end