Method: Rails::Mongoid#remove_indexes
- Defined in:
- lib/rails/mongoid.rb
#remove_indexes(*globs) ⇒ Array<Class>
Remove indexes for each model given the provided globs and the class is not embedded.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/rails/mongoid.rb', line 44 def remove_indexes(*globs) models(*globs).each do |model| next if model. 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 |