Class: Moped::Indexes
- Inherits:
-
Object
- Object
- Moped::Indexes
- Defined in:
- lib/patches/db_commands.rb
Instance Method Summary collapse
Instance Method Details
#[](key) ⇒ Object
24 25 26 27 28 |
# File 'lib/patches/db_commands.rb', line 24 def [](key) list_indexes_command.detect do |index| (index['name'] == key) || (index['key'] == normalize_keys(key)) end end |
#create(key, options = {}) ⇒ Object
30 31 32 33 34 |
# File 'lib/patches/db_commands.rb', line 30 def create(key, = {}) spec = .merge(ns: namespace, key: key) spec[:name] ||= key.to_a.join("_") database.command(createIndexes: collection_name, indexes: [spec]) end |
#each(&block) ⇒ Object
36 37 38 |
# File 'lib/patches/db_commands.rb', line 36 def each(&block) list_indexes_command.each(&block) end |