Module Mongoid::Indexes::ClassMethods
In: lib/mongoid/indexes.rb

Methods

Public Instance methods

Add the default indexes to the root document if they do not already exist. Currently this is only _type.

@example Add Mongoid internal indexes.

  Person.add_indexes

Send the actual index creation comments to the MongoDB driver

@example Create the indexes for the class.

  Person.create_indexes

Adds an index on the field specified. Options can be :unique => true or :unique => false. It will default to the latter.

@example Create a basic index.

  class Person
    include Mongoid::Document
    field :name, :type => String
    index :name, :background => true

@param [ Symbol ] name The name of the field. @param [ Hash ] options The index options.

[Validate]