Module: Mongo::Operation::Write
- Includes:
- ResponseHandling
- Defined in:
- lib/mongo/operation/shared/write.rb
Overview
Shared behavior of operations that write (update, insert, delete).
Instance Method Summary collapse
-
#bulk_execute(server, client:) ⇒ Mongo::Operation::Delete::BulkResult, ...
Execute the bulk write operation.
-
#execute(server, client:) ⇒ Mongo::Operation::Result
Execute the operation.
Instance Method Details
#bulk_execute(server, client:) ⇒ Mongo::Operation::Delete::BulkResult, ...
Execute the bulk write operation.
66 67 68 69 70 71 72 |
# File 'lib/mongo/operation/shared/write.rb', line 66 def bulk_execute(server, client:) if server.features.op_msg_enabled? self.class::OpMsg.new(spec).execute(server, client: client).bulk_result else self.class::Command.new(spec).execute(server, client: client).bulk_result end end |
#execute(server, client:) ⇒ Mongo::Operation::Result
Execute the operation.
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/mongo/operation/shared/write.rb', line 38 def execute(server, client:) validate! op = if server.features.op_msg_enabled? self.class::OpMsg.new(spec) elsif !acknowledged_write? self.class::Legacy.new(spec) else self.class::Command.new(spec) end result = op.execute(server, client: client) validate_result(result, server) end |