I try to model my MongoAlchemy class in Flask. Here is my model:
{
"_id" : ObjectId("adfafdasfafag24t24t"),
"name" : "sth."
"surname" : "sth."
"address" : [
{
"city" : "Dublin"
"country" : "Ireland"
}
]
}
Here is my documents.py class:
class Language_School(db.Document):
name = db.StringField()
surname = db.StringField()
address = db.???
How can I define this like array model (address) in Flask?
Edit: I have already tried to my models like before asking question. But I took error like "AttributeError AttributeError: 'list' object has no attribute 'items'".
class Address(db.Document):
city = db.StringField()
country = db.StringField()
class Language_School(db.Document):
name = db.StringField()
surname = db.StringField()
address = db.DocumentField(Address)