Class: Mongo::Operation::Update::Legacy::Result Private
- Includes:
- Result::UseLegacyErrorParser
- Defined in:
- lib/mongo/operation/update/legacy/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 update on server version <= 2.4.
Constant Summary collapse
- UPDATED_EXISTING =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Whether an existing document was updated.
'updatedExisting'.freeze
- UPSERTED =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The upserted docs field in the result.
'upserted'.freeze
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
Attributes inherited from Result
#connection_description, #replies
Instance Method Summary collapse
-
#matched_count ⇒ Integer
private
Get the number of documents matched.
-
#modified_count ⇒ nil
private
Get the number of documents modified.
-
#upserted_count ⇒ Integer
private
Returns the number of documents upserted.
-
#upserted_id ⇒ Object
private
The identifier of the inserted document if an upsert took place.
Methods included from Result::UseLegacyErrorParser
Methods inherited from Result
#acknowledged?, #cluster_time, #cursor_id, #documents, #each, #error, #initialize, #inspect, #labels, #namespace, #ok?, #operation_time, #reply, #returned_count, #successful?, #topology_version, #validate!, #write_concern_error?, #written_count
Constructor Details
This class inherits a constructor from Mongo::Operation::Result
Instance Method Details
#matched_count ⇒ Integer
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 number of documents matched.
45 46 47 48 49 50 51 52 |
# File 'lib/mongo/operation/update/legacy/result.rb', line 45 def matched_count return 0 unless acknowledged? if upsert? 0 else n end end |
#modified_count ⇒ nil
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 number of documents modified.
62 |
# File 'lib/mongo/operation/update/legacy/result.rb', line 62 def modified_count; end |
#upserted_count ⇒ Integer
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.
Returns the number of documents upserted.
85 86 87 |
# File 'lib/mongo/operation/update/legacy/result.rb', line 85 def upserted_count upsert? ? n : 0 end |
#upserted_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.
The identifier of the inserted document if an upsert
took place.
73 74 75 |
# File 'lib/mongo/operation/update/legacy/result.rb', line 73 def upserted_id first[UPSERTED] if upsert? end |