class Mongoid::Association::Embedded::EmbedsMany::Proxy
def delete(document)
- Since: - 2.0.0.rc.1
Returns:
-
(Document, nil)
- The deleted document or nil if nothing deleted.
Parameters:
-
document
(Document
) -- The document to be deleted.
Other tags:
- Example: Delete the document from the relation. -
def delete(document) execute_callback :before_remove, document doc = _target.delete_one(document) if doc && !_binding? _unscoped.delete_one(doc) unless doc.paranoid? if _assigning? if doc.paranoid? doc.destroy(suppress: true) else _base.add_atomic_pull(doc) end else doc.delete(suppress: true) unbind_one(doc) end end reindex execute_callback :after_remove, document doc end
def deleted
- Since: - 3.0.10
Returns:
-
(Criteria)
- The deleted documents.
Other tags:
- Example: Get the deleted documents from the relation. -
def deleted unscoped.deleted end