RUBY-370: allow :j option
This commit is contained in:
parent
d08b3b8978
commit
8bd94b0ac2
|
@ -225,7 +225,7 @@ module Mongo
|
||||||
cmd = BSON::OrderedHash.new
|
cmd = BSON::OrderedHash.new
|
||||||
cmd[:getlasterror] = 1
|
cmd[:getlasterror] = 1
|
||||||
if opts.is_a?(Hash)
|
if opts.is_a?(Hash)
|
||||||
opts.assert_valid_keys(:w, :wtimeout, :fsync)
|
opts.assert_valid_keys(:w, :wtimeout, :fsync, :j)
|
||||||
cmd.merge!(opts)
|
cmd.merge!(opts)
|
||||||
end
|
end
|
||||||
message.put_binary(BSON::BSON_CODER.serialize(cmd, false).to_s)
|
message.put_binary(BSON::BSON_CODER.serialize(cmd, false).to_s)
|
||||||
|
|
|
@ -206,6 +206,14 @@ class TestCollection < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if @@version >= "2.0.0"
|
||||||
|
def test_safe_mode_with_journal_commit_option
|
||||||
|
@@test.insert({:foo => 1}, :safe => {:j => true})
|
||||||
|
@@test.update({:foo => 1}, {:foo => 2}, :safe => {:j => true})
|
||||||
|
@@test.remove({:foo => 2}, :safe => {:j => true})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_update
|
def test_update
|
||||||
id1 = @@test.save("x" => 5)
|
id1 = @@test.save("x" => 5)
|
||||||
@@test.update({}, {"$inc" => {"x" => 1}})
|
@@test.update({}, {"$inc" => {"x" => 1}})
|
||||||
|
|
Loading…
Reference in New Issue