class Mongo::Operation::Write::CreateUser
A MongoDB create user operation.
@example Initialize the operation.
Write::CreateUser.new(:db_name => 'test', :user => user)
Initialization:
param [ Hash ] spec The specifications for the create. option spec :user [ Auth::User ] The user to create. option spec :db_name [ String ] The name of the database.
@since 2.0.0
Private Instance Methods
message(server)
click to toggle source
# File lib/mongo/operation/write/create_user.rb, line 43 def message(server) user_spec = { user: user.name }.merge(user.spec) Protocol::Insert.new(db_name, Auth::User::COLLECTION, [ user_spec ]) end
write_command_op()
click to toggle source
# File lib/mongo/operation/write/create_user.rb, line 39 def write_command_op Command::CreateUser.new(spec) end