When using a ListField of EnumField, the data in the objects returned from MongoEngne is not converted back to Enums. For example:
class DaysOfTheWeek(Enum):
Mon = 1
Tue = 2
# etc ...
class C(db.Document):
days = db.ListField(db.EnumField(DaysOfTheWeek))
c1 = C(days=[DaysOfTheWeek.Mon])
assert c1.days == [DaysOfTheWeek.Mon] # OK
c1.save()
c2 = C.objects.first()
assert c2.days == [1] # OK
assert c2.days == [DaysOfTheWeek.Mon] # Fails
Is this expected behaviour? Am I using MongoEngine incorrectly?
I am using MongoEngine 0.22.1.