Skip to content

Commit 1e231a3

Browse files
committed
fix: fix json_options for pymongo 3.9
1 parent 389fe1e commit 1e231a3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

mongoengine/pymongo_support.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77

88
PYMONGO_VERSION = tuple(pymongo.version_tuple[:2])
99

10-
LEGACY_JSON_OPTIONS = json_util.LEGACY_JSON_OPTIONS.with_options(
11-
uuid_representation=binary.UuidRepresentation.PYTHON_LEGACY,
12-
)
10+
if PYMONGO_VERSION >= (4,):
11+
LEGACY_JSON_OPTIONS = json_util.LEGACY_JSON_OPTIONS.with_options(
12+
uuid_representation=binary.UuidRepresentation.PYTHON_LEGACY,
13+
)
14+
else:
15+
LEGACY_JSON_OPTIONS = json_util.DEFAULT_JSON_OPTIONS
1316

1417

1518
def count_documents(

0 commit comments

Comments
 (0)