class Mongo::Operation::Write::Command::CreateUser

Create user commands on non-legacy servers.

@since 2.0.0

Public Instance Methods

execute(server) click to toggle source

Execute the operation.

@example Execute the operation.

operation.execute(server)

@param [ Mongo::Server ] server The server to send this operation to.

@return [ Result ] The operation response, if there is one.

@since 2.5.0

# File lib/mongo/operation/write/command/create_user.rb, line 38
def execute(server)
  result = Result.new(server.with_connection do |connection|
    connection.dispatch([ message(server) ], operation_id)
  end)
  server.update_cluster_time(result)
  session.process(result) if session
  result.validate!
end

Private Instance Methods

selector() click to toggle source

The query selector for this create user command operation.

@return [ Hash ] The selector describing this create user operation.

@since 2.0.0

# File lib/mongo/operation/write/command/create_user.rb, line 54
def selector
  { :createUser => user.name, :digestPassword => false }.merge(user.spec)
end