Merge pull request #467 from adamsc64/doc_foreignkey_push_pull_example

Expanded example of using ListFields for one-to-many relationships.
This commit is contained in:
Ross Lawley 2013-09-27 08:31:59 -07:00
commit e146262c38

View File

@ -290,6 +290,12 @@ instance of the object to the query::
# Find all pages that both Bob and John have authored # Find all pages that both Bob and John have authored
Page.objects(authors__all=[bob, john]) 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 Dealing with deletion of referred documents
''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''