Class: Mongo::Operation::Write::Bulk::Insert::Result
- Includes:
- Mergable
- Defined in:
- lib/mongo/operation/write/bulk/insert/result.rb
Overview
Defines custom behaviour of results when inserting.
Constant Summary
Constants inherited from Result
Result::CURSOR, Result::CURSOR_ID, Result::FIRST_BATCH, Result::N, Result::NAMESPACE, Result::NEXT_BATCH, Result::OK, Result::RESULT
Instance Attribute Summary collapse
-
#inserted_ids ⇒ Object
readonly
Get the ids of the inserted documents.
Attributes inherited from Result
Instance Method Summary collapse
-
#initialize(replies, ids) ⇒ Result
constructor
Initialize a new result.
-
#inserted_id ⇒ Object
Gets the id of the document inserted.
-
#n_inserted ⇒ Integer
Gets the number of documents inserted.
Methods included from Mergable
#aggregate_write_concern_errors, #aggregate_write_errors
Methods inherited from Result
#acknowledged?, #cursor_id, #documents, #each, #inspect, #multiple?, #namespace, #ok?, #reply, #returned_count, #successful?, #validate!, #written_count
Constructor Details
Instance Attribute Details
#inserted_ids ⇒ Object (readonly)
Get the ids of the inserted documents.
30 31 32 |
# File 'lib/mongo/operation/write/bulk/insert/result.rb', line 30 def inserted_ids @inserted_ids end |
Instance Method Details
#inserted_id ⇒ Object
Gets the id of the document inserted.
66 67 68 |
# File 'lib/mongo/operation/write/bulk/insert/result.rb', line 66 def inserted_id inserted_ids.first end |
#n_inserted ⇒ Integer
Gets the number of documents inserted.
54 55 56 |
# File 'lib/mongo/operation/write/bulk/insert/result.rb', line 54 def n_inserted written_count end |