Class: Mongoid::Persistence::Atomic::Unset
- Inherits:
-
Object
- Object
- 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, #fields, #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
Methods included from Atomic::Positionable
Instance Method Details
#persist ⇒ nil
Sends the atomic $unset operation to the database.
18 19 20 21 22 23 |
# File 'lib/mongoid/persistence/atomic/unset.rb', line 18 def persist prepare do fields.each { |f| document.attributes.delete(f) } execute("$unset") end end |