Skip to content

TypeError: Unknown type for marshmallow model field was used. #72

Description

@pipozzz

Hi,

I wanted to use custom marshmallow field related to mongo data serialisation

class ObjectIdField(fields.Field):

    def _deserialize(self, value, attr, data, **kwargs):
        try:
            return bson.ObjectId(value)
        except Exception:
            raise ValidationError('invalid ObjectId `%s`' % value)

    def _serialize(self, value, attr, obj, **kwargs):
        if value is None:
            return missing
        return str(value)```

and I'm getting this error: TypeError: Unknown type for marshmallow model field was used.

Could you give me some directions how to deal with this? 

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions