Class: Mongo::Operation::Insert::Result Private
- Defined in:
- lib/mongo/operation/insert/result.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defines custom behavior of results for an insert.
According to the CRUD spec, reporting the inserted ids is optional. It can be added to this class later, if needed.
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
private
Get the ids of the inserted documents.
Attributes inherited from Result
Instance Method Summary collapse
- #bulk_result ⇒ Object private
-
#initialize(replies, ids) ⇒ Result
constructor
private
Initialize a new result.
-
#inserted_id ⇒ Object
private
Gets the id of the document inserted.
Methods inherited from Result
#acknowledged?, #cluster_time, #cursor_id, #documents, #each, #inspect, #labels, #multiple?, #namespace, #ok?, #operation_time, #reply, #returned_count, #successful?, #validate!, #written_count
Constructor Details
#initialize(replies, ids) ⇒ Result
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a new result.
41 42 43 44 |
# File 'lib/mongo/operation/insert/result.rb', line 41 def initialize(replies, ids) @replies = [*replies] if replies @inserted_ids = ids end |
Instance Attribute Details
#inserted_ids ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the ids of the inserted documents.
30 31 32 |
# File 'lib/mongo/operation/insert/result.rb', line 30 def inserted_ids @inserted_ids end |
Instance Method Details
#bulk_result ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
58 59 60 |
# File 'lib/mongo/operation/insert/result.rb', line 58 def bulk_result BulkResult.new(@replies, @inserted_ids) end |
#inserted_id ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Gets the id of the document inserted.
54 55 56 |
# File 'lib/mongo/operation/insert/result.rb', line 54 def inserted_id inserted_ids.first end |