Skip to content

Commit 8bd94b0

Browse files
committed
RUBY-370: allow :j option
1 parent d08b3b8 commit 8bd94b0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/mongo/networking.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def build_last_error_message(message, db_name, opts)
225225
cmd = BSON::OrderedHash.new
226226
cmd[:getlasterror] = 1
227227
if opts.is_a?(Hash)
228-
opts.assert_valid_keys(:w, :wtimeout, :fsync)
228+
opts.assert_valid_keys(:w, :wtimeout, :fsync, :j)
229229
cmd.merge!(opts)
230230
end
231231
message.put_binary(BSON::BSON_CODER.serialize(cmd, false).to_s)

test/collection_test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,14 @@ def test_safe_mode_with_advanced_safe_with_invalid_options
206206
end
207207
end
208208

209+
if @@version >= "2.0.0"
210+
def test_safe_mode_with_journal_commit_option
211+
@@test.insert({:foo => 1}, :safe => {:j => true})
212+
@@test.update({:foo => 1}, {:foo => 2}, :safe => {:j => true})
213+
@@test.remove({:foo => 2}, :safe => {:j => true})
214+
end
215+
end
216+
209217
def test_update
210218
id1 = @@test.save("x" => 5)
211219
@@test.update({}, {"$inc" => {"x" => 1}})

0 commit comments

Comments
 (0)