Skip to content

Commit 4871c5f

Browse files
WaVEVtimgraham
authored andcommitted
Add support for JSONArray function
1 parent 5658544 commit 4871c5f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

django_mongodb_backend/features.py

-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
8888
# of $setIsSubset must be arrays. Second argument is of type: null"
8989
# https://jira.mongodb.org/browse/SERVER-99186
9090
"model_fields_.test_arrayfield.QueryingTests.test_contained_by_subquery",
91-
# JSONArray not implemented.
92-
"db_functions.json.test_json_array.JSONArrayTests",
9391
# Value.as_mql() doesn't call output_field.get_db_prep_save():
9492
# https://github.com/mongodb/django-mongodb-backend/issues/282
9593
"model_fields.test_jsonfield.TestSaveLoad.test_bulk_update_custom_get_prep_value",

django_mongodb_backend/functions.py

+2
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,
@@ -240,6 +241,7 @@ def register_functions():
240241
Cot.as_mql = cot
241242
Extract.as_mql = extract
242243
Func.as_mql = func
244+
JSONArray.as_mql = process_lhs
243245
Left.as_mql = left
244246
Length.as_mql = length
245247
Log.as_mql = log

0 commit comments

Comments
 (0)