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.
This commit is contained in:
parent
31ec7907b5
commit
2f9964e46e
@ -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
|
||||
'''''''''''''''''''''''''''''''''''''''''''
|
||||
|
Loading…
x
Reference in New Issue
Block a user