minor readme tweaks

This commit is contained in:
Stefan Wojcik 2016-12-28 17:18:55 -05:00
parent b013a065f7
commit 96e95ac533

View File

@ -57,7 +57,7 @@ Some simple examples of what MongoEngine code looks like:
class BlogPost(Document): class BlogPost(Document):
title = StringField(required=True, max_length=200) title = StringField(required=True, max_length=200)
posted = DateTimeField(default=datetime.datetime.now) posted = DateTimeField(default=datetime.datetime.utcnow)
tags = ListField(StringField(max_length=50)) tags = ListField(StringField(max_length=50))
meta = {'allow_inheritance': True} meta = {'allow_inheritance': True}
@ -87,17 +87,18 @@ Some simple examples of what MongoEngine code looks like:
... print ... print
... ...
>>> len(BlogPost.objects) # Count all blog posts and its subtypes
>>> BlogPost.objects.count()
2 2
>>> len(TextPost.objects) >>> TextPost.objects.count()
1 1
>>> len(LinkPost.objects) >>> LinkPost.objects.count()
1 1
# Find tagged posts # Count tagged posts
>>> len(BlogPost.objects(tags='mongoengine')) >>> BlogPost.objects(tags='mongoengine').count()
2 2
>>> len(BlogPost.objects(tags='mongodb')) >>> BlogPost.objects(tags='mongodb').count()
1 1
Tests Tests
@ -133,4 +134,4 @@ Community
Contributing Contributing
============ ============
We welcome contributions! see the `Contribution guidelines <https://github.com/MongoEngine/mongoengine/blob/master/CONTRIBUTING.rst>`_ We welcome contributions! See the `Contribution guidelines <https://github.com/MongoEngine/mongoengine/blob/master/CONTRIBUTING.rst>`_