-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Spec Comp
-
None
CRUD specification requires that "The update family of operations require that the update document parameter MUST have only atomic modifiers." and that "The replace family of operations require that the replacement document parameter MUST NOT begin with an atomic modifier.". Ruby driver does not enforce those requirements:
client["users"].insert_one({_id: 1, x: "foo"}) => #<Mongo::Operation::Insert::Result:0x238900 ...> irb(main):007:0> client["users"].update_one({_id: 1}, {x: "bar"}) # No error raised => #<Mongo::Operation::Update::Result:0x264500 ...> irb(main):008:0> client["users"].find().to_a => [{"_id"=>1, "x"=>"bar"}] client["users"].replace_one({_id: 1}, {'$set' => {x: 'bazzzzz'}}) => #<Mongo::Operation::Update::Result:0x432840 ...> # No error raised irb(main):010:0> client["users"].find().to_a => [{"_id"=>1, "x"=>"bazzzzz"}]
We should comply with spec requirement. However, fixing this will change behavior of helpers, so we should probably consider this as a breaking change.
- duplicates
-
RUBY-2996 Implement update and replace validation
- Closed