Class Mongo::Operation::Update::Legacy::Result
In: lib/mongo/operation/update/legacy/result.rb
Parent: Operation::Result

Defines custom behavior of results for an update on server version <= 2.4.

@since 2.0.0

Methods

Constants

UPDATED_EXISTING = 'updatedExisting'.freeze   Whether an existing document was updated.

@since 2.0.0

UPSERTED = 'upserted'.freeze   The upserted docs field in the result.

@since 2.0.0

Public Instance methods

Get the number of documents matched.

@example Get the matched count.

  result.matched_count

@return [ Integer ] The matched count.

@since 2.0.0

Get the number of documents modified.

@example Get the modified count.

  result.modified_count

@return [ nil ] Always omitted for legacy versions.

@since 2.0.0

Returns the number of documents upserted.

@example Get the number of upserted documents.

  result.upserted_count

@return [ Integer ] The number upserted.

@since 2.4.2

The identifier of the inserted document if an upsert

  took place.

@example Get the upserted document‘s identifier.

  result.upserted_id

@return [ Object ] The upserted id.

@since 2.0.0

[Validate]