Skip to content

Commit 1833b1f

Browse files
authored
Add support for JSONArray function
1 parent c23f15e commit 1833b1f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

django_mongodb_backend/features.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
8787
# of $setIsSubset must be arrays. Second argument is of type: null"
8888
# https://jira.mongodb.org/browse/SERVER-99186
8989
"model_fields_.test_arrayfield.QueryingTests.test_contained_by_subquery",
90-
# JSONArray not implemented.
91-
"db_functions.json.test_json_array.JSONArrayTests",
9290
# Some usage of prefetch_related() raises "ColPairs is not supported."
9391
"known_related_objects.tests.ExistingRelatedInstancesTests.test_one_to_one_multi_prefetch_related",
9492
"known_related_objects.tests.ExistingRelatedInstancesTests.test_one_to_one_prefetch_related",

django_mongodb_backend/functions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from django.db import NotSupportedError
22
from django.db.models.expressions import Func
3+
from django.db.models.functions import JSONArray
34
from django.db.models.functions.comparison import Cast, Coalesce, Greatest, Least, NullIf
45
from django.db.models.functions.datetime import (
56
Extract,
@@ -238,6 +239,7 @@ def register_functions():
238239
Cot.as_mql = cot
239240
Extract.as_mql = extract
240241
Func.as_mql = func
242+
JSONArray.as_mql = process_lhs
241243
Left.as_mql = left
242244
Length.as_mql = length
243245
Log.as_mql = log

0 commit comments

Comments
 (0)