Method: XGen::Mongo::Driver::Collection#create_index

Defined in:
lib/mongo/collection.rb

#create_index(field_or_spec) ⇒ Object

Create a new index. field_or_spec should be either a single field name or a Array of [field name, direction] pairs. Directions should be specified as XGen::Mongo::ASCENDING or XGen::Mongo::DESCENDING.



120
121
122
# File 'lib/mongo/collection.rb', line 120

def create_index(field_or_spec)
  @db.create_index(@name, field_or_spec)
end