Module: MongoMapper::Plugins::Indexes::ClassMethods
- Defined in:
- lib/mongo_mapper/plugins/indexes.rb
Instance Method Summary collapse
- #create_index(spec, options = {}) ⇒ Object
- #drop_index(name) ⇒ Object
- #drop_indexes ⇒ Object
- #ensure_index(spec, options = {}) ⇒ Object
Instance Method Details
#create_index(spec, options = {}) ⇒ Object
13 14 15 |
# File 'lib/mongo_mapper/plugins/indexes.rb', line 13 def create_index(spec, = {}) collection.indexes.create_one (spec), end |
#drop_index(name) ⇒ Object
17 18 19 |
# File 'lib/mongo_mapper/plugins/indexes.rb', line 17 def drop_index(name) collection.indexes.drop_one name end |
#drop_indexes ⇒ Object
21 22 23 |
# File 'lib/mongo_mapper/plugins/indexes.rb', line 21 def drop_indexes collection.indexes.drop_all end |
#ensure_index(spec, options = {}) ⇒ Object
8 9 10 11 |
# File 'lib/mongo_mapper/plugins/indexes.rb', line 8 def ensure_index(spec, = {}) #TODO: should we emulate the mongo 1.x behaviour of caching attempts to create indexes? collection.indexes.create_one (spec), end |