class Mongo::Operation::Write::Command::CreateIndex

A MongoDB ensure index write command operation.

@example Create an ensure index command operation.

Write::Command::CreateIndex.new({
  :indexes => [{ :key => { :foo => 1 }, :name => 'foo_1', :unique => true }],
  :db_name => 'test',
  :coll_name => 'test_coll'
})

@since 2.0.0

Private Instance Methods

message(server) click to toggle source
# File lib/mongo/operation/write/command/create_index.rb, line 46
def message(server)
  sel = update_selector_for_write_concern(selector, server)
  Protocol::Query.new(db_name, Database::COMMAND, sel, options)
end
selector() click to toggle source

The query selector for this ensure index command operation.

@return [ Hash ] The selector describing this insert operation.

@since 2.0.0

# File lib/mongo/operation/write/command/create_index.rb, line 42
def selector
  { :createIndexes => coll_name, :indexes => indexes }
end