Module: Mongo::Operation::Write
Overview
Shared behavior of operations that write (update, insert, delete).
Instance Method Summary collapse
-
#bulk_execute(server) ⇒ Mongo::Operation::Delete::BulkResult, ...
Execute the bulk write operation.
-
#execute(server) ⇒ Mongo::Operation::Result
Execute the operation.
Instance Method Details
#bulk_execute(server) ⇒ Mongo::Operation::Delete::BulkResult, ...
Execute the bulk write operation.
57 58 59 60 61 62 63 |
# File 'lib/mongo/operation/shared/write.rb', line 57 def bulk_execute(server) if server.features.op_msg_enabled? self.class::OpMsg.new(spec).execute(server).bulk_result else self.class::Command.new(spec).execute(server).bulk_result end end |
#execute(server) ⇒ Mongo::Operation::Result
Execute the operation.
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/mongo/operation/shared/write.rb', line 33 def execute(server) validate! result = if server.features.op_msg_enabled? self.class::OpMsg.new(spec).execute(server) elsif !acknowledged_write? self.class::Legacy.new(spec).execute(server) else self.class::Command.new(spec).execute(server) end result.validate! end |