Class: DeployMongo::Repository
- Inherits:
-
Object
- Object
- DeployMongo::Repository
- Defined in:
- lib/deploy_mongo/repository.rb
Constant Summary collapse
- PAGE_SIZE =
10
Instance Method Summary collapse
- #get_schema ⇒ Object
-
#initialize(couch_config) ⇒ Repository
constructor
A new instance of Repository.
- #save_schema(json) ⇒ Object
Constructor Details
#initialize(couch_config) ⇒ Repository
Returns a new instance of Repository.
6 7 8 |
# File 'lib/deploy_mongo/repository.rb', line 6 def initialize(couch_config) @config = couch_config end |
Instance Method Details
#get_schema ⇒ Object
10 11 12 13 14 |
# File 'lib/deploy_mongo/repository.rb', line 10 def get_schema db = Mongo::Connection.new(@config.hostname,@config.port,:safe => true).db(@config.database) schema = db.collection("schema").find_one("_id" => "schema__schema_document_key__") schema end |
#save_schema(json) ⇒ Object
16 17 18 19 20 |
# File 'lib/deploy_mongo/repository.rb', line 16 def save_schema(json) db = Mongo::Connection.new(@config.hostname,@config.port,:safe => true).db(@config.database) json = json.merge("_id" => "schema__schema_document_key__") db.collection("schema").save(json) end |