class BSON::Document

def merge!(other)

Other tags:
    Since: - 3.0.0

Returns:
  • (BSON::Document) - The result of the merge.

Parameters:
  • other (BSON::Document, Hash) -- The document/hash to merge with.

Other tags:
    Example: Merge with another document. -
def merge!(other)
  other.each_pair do |key, value|
    value = yield(convert_key(key), self[key], convert_value(value)) if block_given? && self[key]
    self[key] = value
  end
  self
end