Skip to content

Commit df05e93

Browse files
committed
Reorder skiped test and remove toString in regex.
1 parent 1a15c52 commit df05e93

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

django_mongodb/features.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
88
supports_date_lookup_using_string = False
99
supports_foreign_keys = False
1010
supports_ignore_conflicts = False
11-
supports_json_field = True
1211
supports_json_field_contains = False
1312
has_native_json_field = True
1413
# BSON Date type doesn't support microsecond precision.
@@ -42,8 +41,12 @@ class DatabaseFeatures(BaseDatabaseFeatures):
4241
# tuple index out of range in process_rhs()
4342
"lookup.tests.LookupTests.test_exact_sliced_queryset_limit_one",
4443
"lookup.tests.LookupTests.test_exact_sliced_queryset_limit_one_offset",
44+
# Regex lookup doesn't work on non-string fields.
45+
"lookup.tests.LookupTests.test_regex_non_string",
4546
# Substr not implemented.
46-
"lookup.tests.LookupTests.test_pattern_lookups_with_substr",
47+
"lookup.tests.LookupTests.test_pattern_lookups_with_substr"
48+
# Querying ObjectID with string doesn't work.
49+
"lookup.tests.LookupTests.test_lookup_int_as_str",
4750
# Regex lookup doesn't work on json fields.
4851
"model_fields.test_jsonfield.TestQuerying.test_icontains",
4952
# MongoDB gives the wrong result of log(number, base) when base is a
@@ -252,10 +255,9 @@ def django_test_expected_failures(self):
252255
"expressions.tests.NegatedExpressionTests.test_filter",
253256
"expressions_case.tests.CaseExpressionTests.test_annotate_values_not_in_order_by",
254257
"expressions_case.tests.CaseExpressionTests.test_order_by_conditional_implicit",
258+
"model_fields.test_jsonfield.TestQuerying.test_ordering_grouping_by_count",
255259
# annotate().filter().count() gives incorrect results.
256260
"db_functions.datetime.test_extract_trunc.DateFunctionTests.test_extract_year_exact_lookup",
257-
# FieldDoesNotExist with ordering.
258-
"model_fields.test_jsonfield.TestQuerying.test_ordering_grouping_by_count",
259261
},
260262
"Count doesn't work in QuerySet.annotate()": {
261263
"annotations.tests.AliasTests.test_alias_annotate_with_aggregation",

django_mongodb/query_utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,4 @@ def process_rhs(node, compiler, connection):
4848
def regex_match(field, value, regex, *re_args, **re_kwargs):
4949
regex = re.compile(regex % re.escape(value), *re_args, **re_kwargs)
5050
options = "i" if regex.flags & re.I else ""
51-
return {
52-
"$regexMatch": {"input": {"$toString": field}, "regex": regex.pattern, "options": options}
53-
}
51+
return {"$regexMatch": {"input": field, "regex": regex.pattern, "options": options}}

0 commit comments

Comments
 (0)