Class: Mongoid::Persistence::Atomic::Unset
- Includes:
- Operation
- Defined in:
- lib/mongoid/persistence/atomic/unset.rb
Overview
Performs atomic $unset operations.
Instance Attribute Summary
Attributes included from Operation
#document, #field, #options, #value
Instance Method Summary collapse
-
#persist ⇒ nil
Sends the atomic $unset operation to the database.
Methods included from Operation
#collection, #initialize, #operation, #path, #prepare
Instance Method Details
#persist ⇒ nil
Sends the atomic $unset operation to the database.
18 19 20 21 22 23 24 |
# File 'lib/mongoid/persistence/atomic/unset.rb', line 18 def persist prepare do document.attributes.delete(field) collection.update(document.atomic_selector, operation("$unset"), ) document.remove_change(value) end end |