Module: Mongo::JavaImpl::Db_
- Included in:
- DB
- Defined in:
- lib/jmongo/mongo/db.rb
Constant Summary collapse
- SYSTEM_NAMESPACE_COLLECTION =
"system.namespaces"
- SYSTEM_PROFILE_COLLECTION =
"system.profile"
Instance Method Summary collapse
-
#write_concern(safe) ⇒ Object
@collection.save(=> ‘foo’, :safe => nil) —> NONE = new WriteConcern(-1) @collection.save(=> ‘foo’, :safe => true) —> NORMAL = new WriteConcern(0) @collection.save(=> ‘foo’, :safe => => 2) —> new WriteConcern( 2 , 0 , false) @collection.save(=> ‘foo’, :safe => => 2, :wtimeout => 200) —> new WriteConcern( 2 , 200 , false) @collection.save(=> ‘foo’, :safe => => 2, :wtimeout => 200, :fsync => true) —> new WriteConcern( 2 , 0 , true) @collection.save(=> ‘foo’, :safe => => true) —> FSYNC_SAFE = new WriteConcern( 1 , 0 , true).
Instance Method Details
#write_concern(safe) ⇒ Object
@collection.save(=> ‘foo’, :safe => nil) —> NONE = new WriteConcern(-1) @collection.save(=> ‘foo’, :safe => true) —> NORMAL = new WriteConcern(0) @collection.save(=> ‘foo’, :safe => => 2) —> new WriteConcern( 2 , 0 , false) @collection.save(=> ‘foo’, :safe => => 2, :wtimeout => 200) —> new WriteConcern( 2 , 200 , false) @collection.save(=> ‘foo’, :safe => => 2, :wtimeout => 200, :fsync => true) —> new WriteConcern( 2 , 0 , true) @collection.save(=> ‘foo’, :safe => => true) —> FSYNC_SAFE = new WriteConcern( 1 , 0 , true)
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/jmongo/mongo/db.rb', line 16 def write_concern(safe) return @j_db.write_concern if safe.nil? return JMongo::WriteConcern.new(0) if safe.is_a?(FalseClass) return JMongo::WriteConcern.new(1) if safe.is_a?(TrueClass) return JMongo::WriteConcern.new(0) unless safe.is_a?(Hash) w = safe[:w] || 1 t = safe[:wtimeout] || 0 f = !!(safe[:fsync] || false) JMongo::WriteConcern.new(w, t, f) #dont laugh! end |