Module: Mongo::Operation::Executable Private
- Includes:
- ResponseHandling
- Included in:
- Aggregate::Command, CollectionsInfo::Command, Command::Command, Count::Command, Create::Command, CreateIndex::Command, CreateUser::Command, Delete::Command, Delete::Legacy, Distinct::Command, Drop::Command, DropDatabase::Command, DropIndex::Command, Mongo::Operation::Explain::Command, Mongo::Operation::Explain::Legacy, Find::Command, Find::Legacy, GetMore::Command, GetMore::Legacy, Indexes::Command, Indexes::Legacy, Insert::Command, Insert::Legacy, KillCursors::Command, KillCursors::Legacy, ListCollections::Command, MapReduce::Command, OpMsgBase, ParallelScan::Command, RemoveUser::Command, Update::Command, Update::Legacy, UpdateUser::Command, UsersInfo::Command, WriteCommand::Command
- Defined in:
- build/ruby-driver-v2.17/lib/mongo/operation/shared/executable.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Shared executable behavior of operations.
Instance Method Summary collapse
- #do_execute(connection, context, options = {}) ⇒ Object private
- #execute(connection, context:, options: {}) ⇒ Object private
Instance Method Details
#do_execute(connection, context, options = {}) ⇒ 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.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'build/ruby-driver-v2.17/lib/mongo/operation/shared/executable.rb', line 29 def do_execute(connection, context, = {}) unpin_maybe(session) do add_error_labels(connection, context) do add_server_diagnostics(connection) do get_result(connection, context, ).tap do |result| if session if session.in_transaction? && connection.description.load_balancer? then if session.pinned_service_id unless session.pinned_service_id == connection.service_id raise Error::InternalDriverError, "Expected operation to use service #{session.pinned_session_id} but it used #{connection.service_id}" end else session.pin_to_service(connection.service_id) end end if session.snapshot? && !session. session. = result. end end process_result(result, connection) end end end end end |
#execute(connection, context:, options: {}) ⇒ 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 61 62 63 64 65 66 67 68 |
# File 'build/ruby-driver-v2.17/lib/mongo/operation/shared/executable.rb', line 58 def execute(connection, context:, options: {}) if Lint.enabled? unless connection.is_a?(Mongo::Server::Connection) raise Error::LintError, "Connection argument is of wrong type: #{connection}" end end do_execute(connection, context, ).tap do |result| validate_result(result, connection, context) end end |