Skip to content

Instantly share code, notes, and snippets.

@perymerdeka
Created September 2, 2021 14:17
Show Gist options
  • Save perymerdeka/b513bb34235485743feb7a68b0c831f5 to your computer and use it in GitHub Desktop.
Save perymerdeka/b513bb34235485743feb7a68b0c831f5 to your computer and use it in GitHub Desktop.
models mapping for mongo
import mongoengine as me
from datetime import datetime
class Posts(me.Document):
title: str = me.StringField(required=True, max_length=200)
contents: str = me.StringField(required=True)
created_on = me.DateTimeField(default=datetime.now())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment