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
Hi,
I wanted to use custom marshmallow field related to mongo data serialisation