The documentation for 2.1.0 http://docs.mongodb.org/ecosystem/tutorial/ruby-driver-tutorial/#bulk-operations states that the correct format for the update_one operation is:
{ :update_one => { :filter => { :find => { :x => 1 }},
:update => { '$set' => { :x => 2 } },
:upsert => true } # upsert is optional and defaults to false
}
However this did not work for me... I had to use:
{ :update_one => { :filter => { :x => 1 },
:update => { '$set' => { :x => 2 } },
:upsert => true } # upsert is optional and defaults to false
}
that is remove the :find after the filter.
I'm guessing this is also true for the other operation that use filter/find like replace_one, update_many...
Probably this is a leftover from the previous version 2.0.0 which used :find instead of :filter.
- is duplicated by
-
RUBY-1040 Bulk operations: replace_one, update_one, update_many, bulk_write...
- Closed