Skip to content

Commit

Permalink
MongoClient(uuid_representation=) has to be a string
Browse files Browse the repository at this point in the history
The UuidRepresentation enum has integer values. pymongo converts
the string into the enum instance.
  • Loading branch information
cognifloyd committed Sep 19, 2024
1 parent ed47b2a commit ef1c682
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions st2common/st2common/models/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import ssl as ssl_lib

import six
from bson.binary import UuidRepresentation
from oslo_config import cfg
import mongoengine
from mongoengine.queryset import visitor
Expand Down Expand Up @@ -195,7 +194,7 @@ def _db_connect(
# TODO: Add uuid_representation option in st2.conf + a migration guide/script.
# This preserves the uuid handling from pymongo 3.x, but it is not portable:
# https://pymongo.readthedocs.io/en/stable/examples/uuid.html#handling-uuid-data-example
uuid_representation = UuidRepresentation.PYTHON_LEGACY
uuid_representation = "pythonLegacy"

connection = mongoengine.connection.connect(
# kwargs are defined by mongoengine and pymongo.MongoClient:
Expand Down

0 comments on commit ef1c682

Please sign in to comment.