class Mongo::Operation::Commands::Create

A MongoDB create collection operation.

@example Instantiate the operation.

Create.new(selector: { create: 'test' }, :db_name => 'test')

Initialization:

param [ Hash ] spec The specifications for the operation.

option spec :db_name [ String ] The name of the database.
option spec :selector [ Hash ] The create collection selector.
option spec :write_concern [ String ] The write concern to use.
  Only applied for server version >= 3.4.

@since 2.4.0

Private Instance Methods

message(server) click to toggle source
# File lib/mongo/operation/commands/create.rb, line 38
def message(server)
  sel = update_selector_for_write_concern(selector, server)
  if server.features.op_msg_enabled?
    command_op_msg(server, sel, options)
  else
    Protocol::Query.new(db_name, query_coll, sel, options)
  end
end