class Mongo::Operation::Write::Command::Update
A MongoDB update write command operation.
@example Create an update write command operation.
Write::Command::Update.new({ :updates => [{ :q => { :foo => 1 }, :u => { :$set => :bar => 1 }}, :multi => true, :upsert => false :array_filters => [] }], :db_name => 'test', :coll_name => 'test_coll', :write_concern => write_concern, :ordered => true, :bypass_document_validation => true })
@since 2.0.0
Constants
- IDENTIFIER
Private Instance Methods
message(server)
click to toggle source
# File lib/mongo/operation/write/command/update.rb, line 65 def message(server) if server.features.op_msg_enabled? op_msg(server) else Protocol::Query.new(db_name, Database::COMMAND, selector, options) end end
op_msg(server)
click to toggle source
# File lib/mongo/operation/write/command/update.rb, line 54 def op_msg(server) global_args = { update: coll_name, Protocol::Msg::DATABASE_IDENTIFIER => db_name }.merge!(command_options) update_selector_for_session!(global_args, server) section = { type: 1, payload: { identifier: IDENTIFIER, sequence: updates } } flags = unacknowledged_write? ? [:more_to_come] : [:none] Protocol::Msg.new(flags, {}, global_args, section) end
selector()
click to toggle source
# File lib/mongo/operation/write/command/update.rb, line 48 def selector { update: coll_name, updates: updates }.merge(command_options) end