Module: Mongo::Operation::Write Private
- Includes:
- ResponseHandling
- Defined in:
- lib/mongo/operation/shared/write.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 behavior of operations that write (update, insert, delete).
Instance Method Summary collapse
-
#bulk_execute(connection, context:) ⇒ Mongo::Operation::Delete::BulkResult, ...
private
Execute the bulk write operation.
-
#execute(server, context:) ⇒ Mongo::Operation::Result
private
Execute the operation.
-
#execute_with_connection(connection, context:) ⇒ Mongo::Operation::Result
private
Execute the operation.
Instance Method Details
#bulk_execute(connection, context:) ⇒ Mongo::Operation::Delete::BulkResult, ...
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.
Execute the bulk write operation.
73 74 75 76 77 78 79 80 81 |
# File 'lib/mongo/operation/shared/write.rb', line 73 def bulk_execute(connection, context:) Lint.assert_type(connection, Server::Connection) if connection.features.op_msg_enabled? self.class::OpMsg.new(spec).execute(connection, context: context).bulk_result else self.class::Command.new(spec).execute(connection, context: context).bulk_result end end |
#execute(server, context:) ⇒ Mongo::Operation::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.
Execute the operation.
37 38 39 40 41 42 43 44 |
# File 'lib/mongo/operation/shared/write.rb', line 37 def execute(server, context:) server.with_connection( connection_global_id: context.connection_global_id, context: context ) do |connection| execute_with_connection(connection, context: context) end end |
#execute_with_connection(connection, context:) ⇒ Mongo::Operation::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.
Execute the operation.
54 55 56 57 58 59 60 |
# File 'lib/mongo/operation/shared/write.rb', line 54 def execute_with_connection(connection, context:) validate!(connection) op = self.class::OpMsg.new(spec) result = op.execute(connection, context: context) validate_result(result, connection, context) end |