Mongo is a document-oriented database.
Install the required gems:
gem install mongo
gem install bson_ext
第一步,连接到mongo,可以在configure block完成。
require 'sinatra'
require 'mongo'
require 'json/ext' include Mongo configure do
conn=MongoClient.new('localhost',27017)
set :mongo_connection,conn
set :mongo_db,conn.db('test')
end