Module: MongoDbUtils::Model
- Defined in:
- lib/mongo-db-utils/models/db.rb,
lib/mongo-db-utils/models/bucket.rb,
lib/mongo-db-utils/models/config.rb
Defined Under Namespace
Classes: Bucket, Config, Db, ReplicaSetDb
Class Method Summary collapse
-
.db_from_uri(uri) ⇒ Object
This method accepts 2 possible uri formats 1.
Class Method Details
.db_from_uri(uri) ⇒ Object
This method accepts 2 possible uri formats
-
the conventional mongo_uri format: mongodb://xxxxxxxx
-
the non standard way of representing a replicaset uri:
–> replica_set|mongo_uri –> Eg: my-set|mongodb://xxxxxxx This is useful because many mongo commands require the set name when invoking them and this bundles the 2 things together
12 13 14 15 16 17 18 19 |
# File 'lib/mongo-db-utils/models/db.rb', line 12 def self.db_from_uri(uri) if(uri.include? "|") split = uri.split("|") ReplicaSetDb.new(split[1], split[0]) else Db.new(uri) end end |