Skip to content

Commit ff7f534

Browse files
committed
UUID functions unsupported
1 parent 5af03e9 commit ff7f534

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

django_mongodb_backend/functions.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
Trim,
4040
Upper,
4141
)
42+
from django.db.models.functions.uuid import UUID4, UUID7
4243

4344
from .query_utils import process_lhs
4445

@@ -279,6 +280,14 @@ def trunc_time(self, compiler, connection):
279280
}
280281

281282

283+
def uuid4(self, compiler, connection, as_expr=False): # noqa: ARG001
284+
raise NotSupportedError("UUID4 is not supported on this database backend.")
285+
286+
287+
def uuid7(self, compiler, connection, as_expr=False): # noqa: ARG001
288+
raise NotSupportedError("UUID7 is not supported on this database backend.")
289+
290+
282291
def register_functions():
283292
Cast.as_mql_expr = cast
284293
Concat.as_mql_expr = concat
@@ -306,3 +315,5 @@ def register_functions():
306315
TruncDate.as_mql_expr = trunc_date
307316
TruncTime.as_mql_expr = trunc_time
308317
Upper.as_mql_expr = preserve_null("toUpper")
318+
UUID4.as_mql = uuid4
319+
UUID7.as_mql = uuid7

0 commit comments

Comments
 (0)