Skip to content

Add support for EnumField #20

Description

@mk-dinamicka

Currently there is no support for EnumField that is mentioned in MongoEngine docs.

For now attempting to use this field like this raises an exception:

import mongoengine
from enum import Enum
from marshmallow_mongoengine import ModelSchema

class NotificationStyle(Enum):
    SUCCESS = "success"
    FAILURE = "failure"


class Notification(mongoengine.Document):
    style = mongoengine.EnumField(NotificationStyle, default=NotificationStyle.SUCCESS)

class NotificationListSchema(ModelSchema):
    class Meta:
        model = Notification
        model_skip_values = ()

marshmallow_mongoengine.exceptions.ModelConversionError: Could not find field of type <mongoengine.fields.EnumField object at 0x7fc05c3a3e80>.

Please add support for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions