Exception: Mongo::Error::BulkWriteError
- Inherits:
-
Mongo::Error
- Object
- StandardError
- Mongo::Error
- Mongo::Error::BulkWriteError
- Defined in:
- lib/mongo/error/bulk_write_error.rb
Overview
Exception raised if there are write errors upon executing the bulk operation.
Constant Summary
Constants inherited from Mongo::Error
BAD_VALUE, CODE, CURSOR_NOT_FOUND, ERR, ERRMSG, ERROR, TRANSIENT_TRANSACTION_ERROR_LABEL, UNKNOWN_ERROR, UNKNOWN_TRANSACTION_COMMIT_RESULT_LABEL, WRITE_CONCERN_ERROR, WRITE_CONCERN_ERRORS, WRITE_ERRORS
Instance Attribute Summary collapse
-
#result ⇒ BSON::Document
readonly
Result The error result.
Instance Method Summary collapse
-
#initialize(result) ⇒ BulkWriteError
constructor
Instantiate the new exception.
- #to_s ⇒ Object
Methods inherited from Mongo::Error
#change_stream_resumable?, #label?, #labels
Constructor Details
#initialize(result) ⇒ BulkWriteError
Instantiate the new exception.
36 37 38 |
# File 'lib/mongo/error/bulk_write_error.rb', line 36 def initialize(result) @result = result end |
Instance Attribute Details
#result ⇒ BSON::Document (readonly)
Returns result The error result.
25 26 27 |
# File 'lib/mongo/error/bulk_write_error.rb', line 25 def result @result end |
Instance Method Details
#to_s ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/mongo/error/bulk_write_error.rb', line 40 def to_s = 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.name + end |