Method: Mongo::ObjectHelper#update_with_object

Defined in:
lib/mongo_db/object/object_helper.rb

#update_with_object(selector, doc, opts = {}) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/mongo_db/object/object_helper.rb', line 21

def update_with_object selector, doc, opts = {}
  if doc.is_a?(Hash)
    update_without_object selector, doc, opts
  else
    raise "can't use update selector with object (#{selector}, {#{doc}})!" unless selector == nil
    ::Mongo::ObjectSerializer.new(doc).update opts, self
  end
end