mongo_light 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/mongo_light/document.rb +1 -1
- data/lib/mongo_light/version.rb +1 -1
- data/readme.markdown +1 -1
- metadata +1 -1
data/lib/mongo_light/document.rb
CHANGED
|
@@ -72,7 +72,7 @@ module MongoLight
|
|
|
72
72
|
end
|
|
73
73
|
def save(options = nil)
|
|
74
74
|
opts = !options || options.include?(:safe) ? options : {:safe => options}
|
|
75
|
-
opts[:safe].delete(:w) if MongoLight.configuration.skip_replica_concern && opts.include?(:safe) && opts[:safe].is_a?(Hash)
|
|
75
|
+
opts[:safe].delete(:w) if MongoLight.configuration.skip_replica_concern && opts && opts.include?(:safe) && opts[:safe].is_a?(Hash)
|
|
76
76
|
collection.save(self.class.map(@attributes), opts || {})
|
|
77
77
|
end
|
|
78
78
|
def save!(options = {})
|
data/lib/mongo_light/version.rb
CHANGED
data/readme.markdown
CHANGED
|
@@ -16,7 +16,7 @@ Configure MongoLight via `MongoLight.configure`:
|
|
|
16
16
|
This'll automatically handle Passenger forking issues (if Passenger is running).
|
|
17
17
|
|
|
18
18
|
## replica cocnern and testing ##
|
|
19
|
-
For safe writes, I like to use `w:majority`. However, MongoDB will raise an exception if you use this while not using replica sets. This can make testing code more of a pain than necessary. If you configure MongoLight with `config.skip_replica_concern = true`, then `:w => X` or `:w => :majority` will automatically be stripped when calling `save(:w => majority)` or `save!(:w => 3)`.
|
|
19
|
+
For safe writes, I like to use `w:majority`. However, MongoDB will raise an exception if you use this while not using replica sets. This can make testing code more of a pain than necessary. If you configure MongoLight with `config.skip_replica_concern = true`, then `:w => X` or `:w => :majority` will automatically be stripped when calling `save(:w => majority)` or `save!(:w => 3)`. (For example, you could do `config.skip_replica_concern = Rails.env.test?`)
|
|
20
20
|
|
|
21
21
|
## Documents ##
|
|
22
22
|
To define a document include `MongoLight::Document` and define your properties using the `mongo_accessor` method:
|