class Mongo::Error::BulkWriteError
Exception raised if there are write errors upon executing the bulk operation.
@since 2.0.0
Attributes
result[R]
@return [ BSON::Document ] result The error result.
Public Class Methods
new(result)
click to toggle source
Instantiate the new exception.
@example Instantiate the exception.
Mongo::Error::BulkWriteError.new(response)
@param [ Hash ] result A processed response from the server
reporting results of the operation.
@since 2.0.0
# File lib/mongo/error/bulk_write_error.rb, line 36 def initialize(result) @result = result end
Public Instance Methods
to_s()
click to toggle source
# File lib/mongo/error/bulk_write_error.rb, line 40 def to_s messages = if errors = result['writeErrors'] frag = ': ' + errors[0..10].map do |error| "#{error['errmsg']} (#{error['code']})" end.join(', ') if errors.length > 10 frag += '...' else frag end else '' end "#{self.class}: #{messages}" + notes_tail end