Method: Mongoid::Contextual::Atomic#rename
- Defined in:
- lib/mongoid/contextual/atomic.rb
#rename(renames) ⇒ nil
Perform an atomic $rename of fields on the matching documents.
133 134 135 136 137 138 139 |
# File 'lib/mongoid/contextual/atomic.rb', line 133 def rename(renames) operations = renames.inject({}) do |ops, (old_name, new_name)| ops[old_name] = new_name.to_s ops end view.update_many("$rename" => collect_operations(operations)) end |