@@ -12,6 +12,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
12
12
supports_json_field_contains = False
13
13
# BSON Date type doesn't support microsecond precision.
14
14
supports_microsecond_precision = False
15
+ supports_temporal_subtraction = True
15
16
# MongoDB stores datetimes in UTC.
16
17
supports_timezones = False
17
18
# Not implemented: https://github.com/mongodb-labs/django-mongodb/issues/7
@@ -34,6 +35,8 @@ class DatabaseFeatures(BaseDatabaseFeatures):
34
35
"db_functions.tests.FunctionTests.test_nested_function_ordering" ,
35
36
"db_functions.text.test_length.LengthTests.test_ordering" ,
36
37
"db_functions.text.test_strindex.StrIndexTests.test_order_by" ,
38
+ "expressions.tests.BasicExpressionsTests.test_order_by_exists" ,
39
+ "expressions.tests.BasicExpressionsTests.test_order_by_multiline_sql" ,
37
40
"expressions_case.tests.CaseExpressionTests.test_order_by_conditional_explicit" ,
38
41
"lookup.tests.LookupQueryingTests.test_lookup_in_order_by" ,
39
42
"ordering.tests.OrderingTests.test_default_ordering_by_f_expression" ,
@@ -62,6 +65,9 @@ class DatabaseFeatures(BaseDatabaseFeatures):
62
65
# pk__in=queryset doesn't work because subqueries aren't a thing in
63
66
# MongoDB.
64
67
"annotations.tests.NonAggregateAnnotationTestCase.test_annotation_and_alias_filter_in_subquery" ,
68
+ "expressions.tests.BasicExpressionsTests.test_in_subquery" ,
69
+ "expressions.tests.BasicExpressionsTests.test_subquery_group_by_outerref_in_filter" ,
70
+ "expressions.tests.BasicExpressionsTests.test_uuid_pk_subquery" ,
65
71
"model_fields.test_jsonfield.TestQuerying.test_usage_in_subquery" ,
66
72
# Length of null considered zero rather than null.
67
73
"db_functions.text.test_length.LengthTests.test_basic" ,
@@ -70,7 +76,17 @@ class DatabaseFeatures(BaseDatabaseFeatures):
70
76
"model_fields.test_jsonfield.TestQuerying.test_order_grouping_custom_decoder" ,
71
77
"model_fields.test_jsonfield.TestQuerying.test_ordering_by_transform" ,
72
78
"model_fields.test_jsonfield.TestQuerying.test_ordering_grouping_by_key_transform" ,
79
+ # DatabaseOperations.convert_decimalfield_value() crash:
80
+ # 'int' object has no attribute 'to_decimal'.
81
+ "expressions.tests.ExpressionsNumericTests.test_filter_decimal_expression" ,
82
+ "expressions.tests.ValueTests.test_output_field_decimalfield" ,
83
+ # pymongo.errors.OperationFailure: $multiply only supports numeric
84
+ # types, not date. (should be wrapped in DatabaseError).
85
+ "expressions.tests.FTimeDeltaTests.test_invalid_operator" ,
86
+ # InvalidDocument: cannot encode object of type: <class 'datetime.time'>
87
+ "expressions.tests.FTimeDeltaTests.test_time_subtraction" ,
73
88
}
89
+
74
90
# $bitAnd, #bitOr, and $bitXor are new in MongoDB 6.3.
75
91
_django_test_expected_failures_bitwise = {
76
92
"expressions.tests.ExpressionOperatorTests.test_lefthand_bitwise_and" ,
@@ -93,6 +109,10 @@ def django_test_expected_failures(self):
93
109
"Insert expressions aren't supported." : {
94
110
"bulk_create.tests.BulkCreateTests.test_bulk_insert_now" ,
95
111
"bulk_create.tests.BulkCreateTests.test_bulk_insert_expressions" ,
112
+ "expressions.tests.BasicExpressionsTests.test_new_object_create" ,
113
+ "expressions.tests.BasicExpressionsTests.test_new_object_save" ,
114
+ "expressions.tests.BasicExpressionsTests.test_object_create_with_aggregate" ,
115
+ "expressions.tests.BasicExpressionsTests.test_object_create_with_f_expression_in_subquery" ,
96
116
# PI()
97
117
"db_functions.math.test_round.RoundTests.test_decimal_with_precision" ,
98
118
"db_functions.math.test_round.RoundTests.test_float_with_precision" ,
@@ -117,6 +137,21 @@ def django_test_expected_failures(self):
117
137
"db_functions.text.test_replace.ReplaceTests.test_update" ,
118
138
"db_functions.text.test_substr.SubstrTests.test_basic" ,
119
139
"db_functions.text.test_upper.UpperTests.test_basic" ,
140
+ "expressions.tests.BasicExpressionsTests.test_arithmetic" ,
141
+ "expressions.tests.BasicExpressionsTests.test_filter_with_join" ,
142
+ "expressions.tests.BasicExpressionsTests.test_object_update" ,
143
+ "expressions.tests.BasicExpressionsTests.test_object_update_unsaved_objects" ,
144
+ "expressions.tests.BasicExpressionsTests.test_order_of_operations" ,
145
+ "expressions.tests.BasicExpressionsTests.test_parenthesis_priority" ,
146
+ "expressions.tests.BasicExpressionsTests.test_update" ,
147
+ "expressions.tests.BasicExpressionsTests.test_update_with_fk" ,
148
+ "expressions.tests.BasicExpressionsTests.test_update_with_none" ,
149
+ "expressions.tests.ExpressionsNumericTests.test_decimal_expression" ,
150
+ "expressions.tests.ExpressionsNumericTests.test_increment_value" ,
151
+ "expressions.tests.FTimeDeltaTests.test_delta_update" ,
152
+ "expressions.tests.FTimeDeltaTests.test_negative_timedelta_update" ,
153
+ "expressions.tests.ValueTests.test_update_TimeField_using_Value" ,
154
+ "expressions.tests.ValueTests.test_update_UUIDField_using_Value" ,
120
155
"expressions_case.tests.CaseDocumentationExamples.test_conditional_update_example" ,
121
156
"expressions_case.tests.CaseExpressionTests.test_update" ,
122
157
"expressions_case.tests.CaseExpressionTests.test_update_big_integer" ,
@@ -215,13 +250,25 @@ def django_test_expected_failures(self):
215
250
"expressions_case.tests.CaseExpressionTests.test_aggregate_with_expression_as_value" ,
216
251
"expressions_case.tests.CaseExpressionTests.test_aggregation_empty_cases" ,
217
252
"lookup.tests.LookupQueryingTests.test_aggregate_combined_lookup" ,
253
+ "expressions.test_queryset_values.ValuesExpressionsTests.test_chained_values_with_expression" ,
254
+ "expressions.test_queryset_values.ValuesExpressionsTests.test_values_expression_group_by" ,
218
255
"from_db_value.tests.FromDBValueTest.test_aggregation" ,
219
256
"timezones.tests.LegacyDatabaseTests.test_query_aggregation" ,
220
257
"timezones.tests.NewDatabaseTests.test_query_aggregation" ,
221
258
},
222
259
"QuerySet.annotate() has some limitations." : {
223
260
# Exists not supported.
224
261
"annotations.tests.NonAggregateAnnotationTestCase.test_annotation_exists_none_query" ,
262
+ "expressions.tests.BasicExpressionsTests.test_annotation_with_deeply_nested_outerref" ,
263
+ "expressions.tests.BasicExpressionsTests.test_boolean_expression_combined" ,
264
+ "expressions.tests.BasicExpressionsTests.test_boolean_expression_combined_with_empty_Q" ,
265
+ "expressions.tests.BasicExpressionsTests.test_boolean_expression_in_Q" ,
266
+ "expressions.tests.BasicExpressionsTests.test_case_in_filter_if_boolean_output_field" ,
267
+ "expressions.tests.BasicExpressionsTests.test_exists_in_filter" ,
268
+ "expressions.tests.ExistsTests.test_filter_by_empty_exists" ,
269
+ "expressions.tests.ExistsTests.test_negated_empty_exists" ,
270
+ "expressions.tests.ExistsTests.test_optimizations" ,
271
+ "expressions.tests.ExistsTests.test_select_negated_empty_exists" ,
225
272
"lookup.tests.LookupTests.test_exact_exists" ,
226
273
"lookup.tests.LookupTests.test_nested_outerref_lhs" ,
227
274
"lookup.tests.LookupQueryingTests.test_filter_exists_lhs" ,
@@ -235,16 +282,35 @@ def django_test_expected_failures(self):
235
282
"db_functions.comparison.test_coalesce.CoalesceTests.test_empty_queryset" ,
236
283
"db_functions.datetime.test_extract_trunc.DateFunctionTests.test_extract_outerref" ,
237
284
"db_functions.datetime.test_extract_trunc.DateFunctionTests.test_trunc_subquery_with_parameters" ,
285
+ "expressions.tests.BasicExpressionsTests.test_aggregate_subquery_annotation" ,
286
+ "expressions.tests.BasicExpressionsTests.test_annotation_with_nested_outerref" ,
287
+ "expressions.tests.BasicExpressionsTests.test_annotation_with_outerref" ,
288
+ "expressions.tests.BasicExpressionsTests.test_annotations_within_subquery" ,
289
+ "expressions.tests.BasicExpressionsTests.test_nested_subquery" ,
290
+ "expressions.tests.BasicExpressionsTests.test_nested_subquery_join_outer_ref" ,
291
+ "expressions.tests.BasicExpressionsTests.test_nested_subquery_outer_ref_2" ,
292
+ "expressions.tests.BasicExpressionsTests.test_nested_subquery_outer_ref_with_autofield" ,
293
+ "expressions.tests.BasicExpressionsTests.test_nested_outerref_with_function" ,
294
+ "expressions.tests.BasicExpressionsTests.test_subquery" ,
295
+ "expressions.tests.BasicExpressionsTests.test_subquery_filter_by_aggregate" ,
296
+ "expressions.tests.BasicExpressionsTests.test_subquery_filter_by_lazy" ,
297
+ "expressions.tests.BasicExpressionsTests.test_subquery_in_filter" ,
298
+ "expressions.tests.BasicExpressionsTests.test_subquery_references_joined_table_twice" ,
238
299
"expressions_case.tests.CaseExpressionTests.test_in_subquery" ,
239
300
"lookup.tests.LookupQueryingTests.test_filter_subquery_lhs" ,
240
301
"model_fields.test_jsonfield.TestQuerying.test_nested_key_transform_on_subquery" ,
241
302
"model_fields.test_jsonfield.TestQuerying.test_obj_subquery_lookup" ,
303
+ # 'Query' object has no attribute 'as_mql'
304
+ "expressions.tests.FTimeDeltaTests.test_date_subquery_subtraction" ,
305
+ "expressions.tests.FTimeDeltaTests.test_datetime_subquery_subtraction" ,
306
+ "expressions.tests.FTimeDeltaTests.test_time_subquery_subtraction" ,
242
307
# Invalid $project :: caused by :: Unknown expression $count,
243
308
"annotations.tests.NonAggregateAnnotationTestCase.test_combined_expression_annotation_with_aggregation" ,
244
309
"annotations.tests.NonAggregateAnnotationTestCase.test_combined_f_expression_annotation_with_aggregation" ,
245
310
"annotations.tests.NonAggregateAnnotationTestCase.test_full_expression_annotation_with_aggregation" ,
246
311
"annotations.tests.NonAggregateAnnotationTestCase.test_grouping_by_q_expression_annotation" ,
247
312
"annotations.tests.NonAggregateAnnotationTestCase.test_q_expression_annotation_with_aggregation" ,
313
+ "expressions.tests.FieldTransformTests.test_month_aggregation" ,
248
314
"expressions_case.tests.CaseDocumentationExamples.test_conditional_aggregation_example" ,
249
315
# Func not implemented.
250
316
"annotations.tests.NonAggregateAnnotationTestCase.test_custom_functions" ,
@@ -322,6 +388,14 @@ def django_test_expected_failures(self):
322
388
"defer.tests.DeferTests.test_only_baseclass_when_subclass_has_no_added_fields" ,
323
389
"defer.tests.TestDefer2.test_defer_inheritance_pk_chaining" ,
324
390
"defer_regress.tests.DeferRegressionTest.test_ticket_16409" ,
391
+ "expressions.test_queryset_values.ValuesExpressionsTests.test_values_expression" ,
392
+ "expressions.test_queryset_values.ValuesExpressionsTests.test_values_list_expression" ,
393
+ "expressions.test_queryset_values.ValuesExpressionsTests.test_values_list_expression_flat" ,
394
+ "expressions.tests.BasicExpressionsTests.test_annotate_values_aggregate" ,
395
+ "expressions.tests.BasicExpressionsTests.test_outerref_mixed_case_table_name" ,
396
+ "expressions.tests.BasicExpressionsTests.test_outerref_with_operator" ,
397
+ "expressions.tests.IterableLookupInnerExpressionsTests.test_expressions_in_lookups_join_choice" ,
398
+ "expressions.tests.IterableLookupInnerExpressionsTests.test_in_lookup_allows_F_expressions_and_expressions_for_datetimes" ,
325
399
"expressions_case.tests.CaseExpressionTests.test_annotate_with_aggregation_in_condition" ,
326
400
"expressions_case.tests.CaseExpressionTests.test_annotate_with_aggregation_in_predicate" ,
327
401
"expressions_case.tests.CaseExpressionTests.test_annotate_with_aggregation_in_value" ,
@@ -378,6 +452,8 @@ def django_test_expected_failures(self):
378
452
},
379
453
"Test executes raw SQL." : {
380
454
"annotations.tests.NonAggregateAnnotationTestCase.test_raw_sql_with_inherited_field" ,
455
+ "expressions.tests.BasicExpressionsTests.test_annotate_values_filter" ,
456
+ "expressions.tests.BasicExpressionsTests.test_filtering_on_rawsql_that_is_boolean" ,
381
457
"model_fields.test_jsonfield.TestQuerying.test_key_sql_injection_escape" ,
382
458
"model_fields.test_jsonfield.TestQuerying.test_key_transform_raw_expression" ,
383
459
"model_fields.test_jsonfield.TestQuerying.test_nested_key_transform_raw_expression" ,
@@ -417,6 +493,7 @@ def django_test_expected_failures(self):
417
493
"db_functions.datetime.test_extract_trunc.DateFunctionTests.test_trunc_date_func" ,
418
494
"db_functions.datetime.test_extract_trunc.DateFunctionTests.test_trunc_date_none" ,
419
495
"db_functions.datetime.test_extract_trunc.DateFunctionTests.test_trunc_lookup_name_sql_injection" ,
496
+ "expressions.tests.FieldTransformTests.test_multiple_transforms_in_values" ,
420
497
"model_fields.test_datetimefield.DateTimeFieldTests.test_lookup_date_with_use_tz" ,
421
498
"model_fields.test_datetimefield.DateTimeFieldTests.test_lookup_date_without_use_tz" ,
422
499
"timezones.tests.NewDatabaseTests.test_query_convert_timezones" ,
0 commit comments