Sha256: 9235e15ba758528af4a96dbf593b6151f0c86626c7c11b3d053d21f18751baec
Contents?: true
Size: 1.2 KB
Versions: 188
Compression:
Stored size: 1.2 KB
Contents
# encoding: utf-8 module Mongoid #:nodoc: module Persistence #:nodoc: module Operations #:nodoc: module Embedded #:nodoc: # Remove is a persistence command responsible for deleting a document from # the database. # # The underlying query resembles the following MongoDB query: # # collection.remove( # { "_id" : 1 }, # false # ); class Remove include Deletion, Operations # Remove the document from the database. If the parent is a new record, # it will get removed in Ruby only. If the parent is not a new record # then either an $unset or $set will occur, depending if it's an # embeds_one or embeds_many. # # @example Remove an embedded document. # RemoveEmbedded.persist # # @return [ true ] Always true. def persist prepare do |doc| parent.remove_child(doc) if notifying_parent? if parent.persisted? collection.update(parent.atomic_selector, deletes, options) end end end end end end end end
Version data entries
188 entries across 96 versions & 4 rubygems