From 2f9964e46efc54908cf8ab20dcd6fafcbe42c227 Mon Sep 17 00:00:00 2001 From: Christopher Adams Date: Tue, 17 Sep 2013 00:02:36 -0400 Subject: [PATCH] Expanded example of using ListFields for one-to-many relationships. - Added an example of how to use the atomic update operations to pull and push to a ListField containing ReferenceFields. --- docs/guide/defining-documents.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/guide/defining-documents.rst b/docs/guide/defining-documents.rst index 3ee77961..3ef18e32 100644 --- a/docs/guide/defining-documents.rst +++ b/docs/guide/defining-documents.rst @@ -287,6 +287,12 @@ instance of the object to the query:: # Find all pages that both Bob and John have authored Page.objects(authors__all=[bob, john]) + # Remove Bob from the authors for a page. + Page.objects(id='...').update_one(pull__authors=bob) + + # Add John to the authors for a page. + Page.objects(id='...').update_one(push__authors=john) + Dealing with deletion of referred documents '''''''''''''''''''''''''''''''''''''''''''