I want to understand why do we need to define a data model like the following. What is the purpose and advantages of having this?
class Gender(Document):
name = StringField(max_length=60, required=True, unique=True)
def __unicode__(self):
return self.name
def __repr__(self):
return self.name
def __str__(self):
return self.name
I am building a flask api using MongoDb as the database.