# File lib/mongoid/persistence/atomic/pop.rb, line 19 def persist prepare do if document[field] values = document.send(field) value > 0 ? values.pop : values.shift values.tap do collection.update(document.atomic_selector, operation("$pop"), options) document.remove_change(field) if document.persisted? end end end end