lib/rails/mongoid.rb
# Remove indexes for each model given the provided globs and the class is
# not embedded.
#
# @example Remove all the indexes.
#   Rails::Mongoid.remove_indexes
#
# @return [ Array<Class> ] The un-indexed models.
#
Remove indexes for each model given the provided globs and the class is
not embedded.
Remove indexes for each model given the provided globs and the class is not embedded .
def remove_indexes
      ::Mongoid.models.each do |model|
        next if model.embedded?
        indexes = model.collection.indexes.map{ |doc| doc["name"] }
        indexes.delete_one("_id_")
        model.remove_indexes
        logger.info("MONGOID: Removing indexes on: #{model} for: #{indexes.join(', ')}.")
        model
      end.compact
    end
def remove_indexes :: Mongoid . models . each do | model | next if model . embedded? indexes = model . collection . indexes . map { | doc | doc [ "name" ] } indexes . delete_one ( "_id_" ) model . remove_indexes logger . info ( "MONGOID: Removing indexes on: #{model} for: #{indexes.join(', ')}." ) model end . compact end
Remove indexes for each model given the provided globs and the class is
not embedded.
Remove indexes for each model given the provided globs and the class is not embedded .
The un-indexed models.
The un - indexed models .
 Array<Class> 
example
Remove all the indexes. Rails::Mongoid.remove_indexes
Remove all the indexes . Rails :: Mongoid . remove_indexes