class Mongo::Operation::Update::Legacy

A MongoDB update operation sent as a legacy wire protocol message.

@api private

@since 2.5.2

Private Instance Methods

gle() click to toggle source
# File lib/mongo/operation/update/legacy.rb, line 62
def gle
  wc = write_concern ||  WriteConcern.get(WriteConcern::DEFAULT)
  if gle_message = wc.get_last_error
    Protocol::Query.new(
      db_name,
      Database::COMMAND,
      gle_message,
      options.merge(limit: -1),
    )
  end
end
message(connection) click to toggle source
# File lib/mongo/operation/update/legacy.rb, line 46
def message(connection)
  selector = selector(connection)

  flags = []
  flags << :multi_update if selector[Operation::MULTI]
  flags << :upsert if selector[Operation::UPSERT]

  Protocol::Update.new(
    db_name,
    coll_name,
    selector[Operation::Q],
    selector[Operation::U],
    flags.empty? ? {} : { flags: flags },
  )
end
selector(connection) click to toggle source
# File lib/mongo/operation/update/legacy.rb, line 37
def selector(connection)
  # This returns the first update.
  # The driver only puts one update into the list normally, so this
  # doesn't discard operations.
  send(IDENTIFIER).first.tap do |selector|
    validate_find_options(connection, selector)
  end
end