Squashed commit of the following:
commit48f988acd7Merge:65269231304f27Author: Ross Lawley <ross.lawley@gmail.com> Date: Thu Jul 26 08:17:45 2012 -0700 Merge pull request #44 from faulkner/fix-notes Proper syntax for RST notes (so they actually render). commit6526923345Author: Ross Lawley <ross.lawley@gmail.com> Date: Thu Jul 26 16:00:32 2012 +0100 Fixed recursion loading bug in _get_changed_fields fixes hmarr/mongoengine#548 commit24fd1acce6Author: Ross Lawley <ross.lawley@gmail.com> Date: Thu Jul 26 14:14:10 2012 +0100 Version bump commitcbb9235dc5Merge:6459d4c19ec2c9Author: Ross Lawley <ross.lawley@gmail.com> Date: Wed Jul 25 15:12:34 2012 +0100 Merge branch 'master' of github.com:hmarr/mongoengine commit19ec2c9bc9Merge:3070e0b601f0ebAuthor: Ross Lawley <ross.lawley@gmail.com> Date: Wed Jul 25 07:12:07 2012 -0700 Merge pull request #545 from maxcountryman/patch-1 Correcting typo in DynamicField docstring commit6459d4c0b6Author: Ross Lawley <ross.lawley@gmail.com> Date: Wed Jul 25 14:55:10 2012 +0100 Fixed issue with custom queryset manager expecting explict variable names If using / expecting kwargs you have to call the queryset manager explicitly. commit1304f2721fAuthor: Chris Faulkner <thefaulkner@gmail.com> Date: Tue Jul 24 14:06:43 2012 -0700 Proper syntax for RST notes (so they actually render). commit598ffd3e5cAuthor: Ross Lawley <ross.lawley@gmail.com> Date: Mon Jul 23 15:32:02 2012 +0100 Fixed documentation commit601f0eb168Author: Max Countryman <maxc@me.com> Date: Fri Jul 20 19:12:43 2012 -0700 Correcting typo in DynamicField docstring
This commit is contained in:
		| @@ -259,6 +259,35 @@ as the constructor's argument:: | ||||
|         content = StringField() | ||||
|  | ||||
|  | ||||
| .. _one-to-many-with-listfields: | ||||
|  | ||||
| One to Many with ListFields | ||||
| ''''''''''''''''''''''''''' | ||||
|  | ||||
| If you are implementing a one to many relationship via a list of references, | ||||
| then the references are stored as DBRefs and to query you need to pass an | ||||
| instance of the object to the query:: | ||||
|  | ||||
|     class User(Document): | ||||
|         name = StringField() | ||||
|  | ||||
|     class Page(Document): | ||||
|         content = StringField() | ||||
|         authors = ListField(ReferenceField(User)) | ||||
|  | ||||
|     bob = User(name="Bob Jones").save() | ||||
|     john = User(name="John Smith").save() | ||||
|  | ||||
|     Page(content="Test Page", authors=[bob, john]).save() | ||||
|     Page(content="Another Page", authors=[john]).save() | ||||
|  | ||||
|     # Find all pages Bob authored | ||||
|     Page.objects(authors__in=[bob]) | ||||
|  | ||||
|     # Find all pages that both Bob and John have authored | ||||
|     Page.objects(authors__all=[bob, john]) | ||||
|  | ||||
|  | ||||
| Dealing with deletion of referred documents | ||||
| ''''''''''''''''''''''''''''''''''''''''''' | ||||
| By default, MongoDB doesn't check the integrity of your data, so deleting | ||||
|   | ||||
		Reference in New Issue
	
	Block a user