The migration guide describes the breaking 4.0 uuidRepresentation change (
PYTHON-2245) like this:
The default uuid_representation for CodecOptions, JSONOptions, and MongoClient has been changed from bson.binary.UuidRepresentation.PYTHON_LEGACY to bson.binary.UuidRepresentation.UNSPECIFIED. Attempting to encode a uuid.UUID instance to BSON or JSON now produces an error by default. See Handling UUID Data for details.
We should add guidance for how applications should decide to set uuidRepresentation when upgrading. Something like:
bq Applications that already store UUIDs in MongoDB using the PyMongo 3 default behavior need to set uuidRepresentation=pythonLegacy in the connection string. If they don't store UUIDs then they should set uuidRepresentation=standard.
We should also include an example error: