Mongoengine + Flash Development tips (1)


1. The data model class refers to itself, such as a list of people who are concerned

carelist = ListField(ReferenceField('self'))

2. Query the reference field. The reference field can only query the objectid, and other fields cannot be queried, unless the objectid of the target object is found first, and then the reference field is used to query in the following way

posts = Post.objects(

3. The first function must be used to query a single object, otherwise the result is a dataset. Even if there is only one, some operations supported by single data are not supported


4. Delete the referenced data associated with a domain


5. Query the subset of data set, that isselect a,b from foo

post = BlogPost.objects(...).only("title", "")