Class: Mongoid::Persistence::Atomic::Pull
- Inherits:
-
Object
- Object
- Mongoid::Persistence::Atomic::Pull
- Includes:
- Operation
- Defined in:
- lib/mongoid/persistence/atomic/pull.rb
Overview
This class provides the ability to perform an explicit $pull modification on a specific field.
Instance Attribute Summary
Attributes included from Operation
#document, #fields, #options, #value
Instance Method Summary collapse
-
#persist ⇒ Object
Sends the atomic $pull operation to the database.
Methods included from Operation
#collection, #initialize, #operation, #path, #prepare
Methods included from Atomic::Positionable
Instance Method Details
#persist ⇒ Object
Sends the atomic $pull operation to the database.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mongoid/persistence/atomic/pull.rb', line 19 def persist prepare do if document[field] values = document.send(field) values.delete(value) execute("$pull") values end end end |