Class Mongo::Operation::Update::BulkResult
In: lib/mongo/operation/update/bulk_result.rb
Parent: Operation::Result

Defines custom behavior of results for an udpate when sent as part of a bulk write.

@since 2.0.0

Methods

Included Modules

Aggregatable

Constants

MODIFIED = 'nModified'.freeze   The number of modified docs field in the result.

@since 2.0.0

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

@since 2.0.0

Public Instance methods

Gets the number of documents matched.

@example Get the matched count.

  result.n_matched

@return [ Integer ] The number of documents matched.

@since 2.0.0

Gets the number of documents modified. Not that in a mixed sharded cluster a call to update could return nModified (>= 2.6) or not (<= 2.4). If any call does not return nModified we can‘t report a valid final count so set the field to nil.

@example Get the modified count.

  result.n_modified

@return [ Integer ] The number of documents modified.

@since 2.0.0

Gets the number of documents upserted.

@example Get the upserted count.

  result.n_upserted

@return [ Integer ] The number of documents upserted.

@since 2.0.0

Get the upserted documents.

@example Get upserted documents.

  result.upserted

@return [ Array<BSON::Document> ] The upserted document info

@since 2.1.0

[Validate]