[Sinatra、Mongo] Mongo

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
上一篇:CQRS架构设计及其实现


下一篇:DDD CQRS架构和传统架构的优缺点比较