I'm in the process of setting up a mapping in Ming ODM. One issue that has come up is how to map a custom type to a field, and how to pass that custom type into .query
Basically, I have an object to represent a Customer ID. I'd like the FieldProperty to take and return an object of this type, rather than one of the builtin types. The type is convertible to and from an int, and it will be stored as an int in Mongo, but in the data model and other Python code I want to pass it around as this domain-specific type.
When passing an instance of CustomerID type directly as a kwd argument to .query
, PyMongo complains that it doesn't understand the type.