Answers for "flask mongoengine mapping objects"

0

flask mongoengine mapping objects

'''
1. Configuration
2. Mapping Objects

* flask mongoengine step 2

-To declare a model that represents a Mongo document, 
create a class that inherits from Document and declare
each of the fields.'''
import mongoengine as me

class Movie(me.Document):
    title = me.StringField(required=True)
    year = me.IntField()
    rated = me.StringField()
    director = me.StringField()
    actors = me.ListField()
Posted by: Guest on March-29-2021

Python Answers by Framework

Browse Popular Code Answers by Language