Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (26 sloc) 949 Bytes
require 'rubygems'
require 'pathname'
root_path = Pathname(__FILE__).dirname.join('..').expand_path
lib_path = root_path.join('lib')
require 'adapter/mongo_atomic'
key =
full_doc = {'a' => 'c', 'b' => 'd'}
partial_doc = {'a' => 'z'}
client ='adapter')['testing']
adapter = Adapter[:mongo].new(client)
atomic_adapter = Adapter[:mongo_atomic].new(client)
adapter.write(key, full_doc)
adapter.write(key, partial_doc)
doc =
# full doc must always be written with :mongo adapter
puts 'Should be {"a"=>"z"}: ' + doc.inspect
atomic_adapter.write(key, full_doc)
atomic_adapter.write(key, partial_doc)
doc =
# partial updates can be written with atomic adapter as $set is used
puts 'Should be {"a"=>"z", "b"=>"d"}: ' + doc.inspect
Jump to Line
Something went wrong with that request. Please try again.