@@ -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" ,
@@ -61,6 +64,23 @@ class DatabaseFeatures(BaseDatabaseFeatures):
61
64
"model_fields.test_jsonfield.TestQuerying.test_order_grouping_custom_decoder" ,
62
65
"model_fields.test_jsonfield.TestQuerying.test_ordering_by_transform" ,
63
66
"model_fields.test_jsonfield.TestQuerying.test_ordering_grouping_by_key_transform" ,
67
+ # DatabaseOperations.convert_decimalfield_value() crash:
68
+ # 'int' object has no attribute 'to_decimal'.
69
+ "expressions.tests.ExpressionsNumericTests.test_filter_decimal_expression" ,
70
+ "expressions.tests.ValueTests.test_output_field_decimalfield" ,
71
+ # pymongo.errors.OperationFailure: $multiply only supports numeric
72
+ # types, not date. (should be wrapped in DatabaseError).
73
+ "expressions.tests.FTimeDeltaTests.test_invalid_operator" ,
74
+ # InvalidDocument: cannot encode object of type: <class 'datetime.time'>
75
+ "expressions.tests.FTimeDeltaTests.test_time_subtraction" ,
76
+ # crash in DatabaseOperations.convert_durationfield_value():
77
+ # unsupported type for timedelta milliseconds component: Decimal128
78
+ "expressions.tests.FTimeDeltaTests.test_durationfield_multiply_divide" ,
79
+ # 'Ref' object has no attribute 'as_mql'.
80
+ "expressions.tests.BasicExpressionsTests.test_aggregate_subquery_annotation" ,
81
+ # AttributeError: pattern_ops
82
+ "expressions.tests.BasicExpressionsTests.test_annotation_with_nested_outerref" ,
83
+ "expressions.tests.BasicExpressionsTests.test_nested_outerref_with_function" ,
64
84
}
65
85
# $bitAnd, #bitOr, and $bitXor are new in MongoDB 6.3.
66
86
_django_test_expected_failures_bitwise = {
@@ -84,6 +104,10 @@ def django_test_expected_failures(self):
84
104
"Insert expressions aren't supported." : {
85
105
"bulk_create.tests.BulkCreateTests.test_bulk_insert_now" ,
86
106
"bulk_create.tests.BulkCreateTests.test_bulk_insert_expressions" ,
107
+ "expressions.tests.BasicExpressionsTests.test_new_object_create" ,
108
+ "expressions.tests.BasicExpressionsTests.test_new_object_save" ,
109
+ "expressions.tests.BasicExpressionsTests.test_object_create_with_aggregate" ,
110
+ "expressions.tests.BasicExpressionsTests.test_object_create_with_f_expression_in_subquery" ,
87
111
# PI()
88
112
"db_functions.math.test_round.RoundTests.test_decimal_with_precision" ,
89
113
"db_functions.math.test_round.RoundTests.test_float_with_precision" ,
@@ -108,6 +132,21 @@ def django_test_expected_failures(self):
108
132
"db_functions.text.test_replace.ReplaceTests.test_update" ,
109
133
"db_functions.text.test_substr.SubstrTests.test_basic" ,
110
134
"db_functions.text.test_upper.UpperTests.test_basic" ,
135
+ "expressions.tests.BasicExpressionsTests.test_arithmetic" ,
136
+ "expressions.tests.BasicExpressionsTests.test_filter_with_join" ,
137
+ "expressions.tests.BasicExpressionsTests.test_object_update" ,
138
+ "expressions.tests.BasicExpressionsTests.test_object_update_unsaved_objects" ,
139
+ "expressions.tests.BasicExpressionsTests.test_order_of_operations" ,
140
+ "expressions.tests.BasicExpressionsTests.test_parenthesis_priority" ,
141
+ "expressions.tests.BasicExpressionsTests.test_update" ,
142
+ "expressions.tests.BasicExpressionsTests.test_update_with_fk" ,
143
+ "expressions.tests.BasicExpressionsTests.test_update_with_none" ,
144
+ "expressions.tests.ExpressionsNumericTests.test_decimal_expression" ,
145
+ "expressions.tests.ExpressionsNumericTests.test_increment_value" ,
146
+ "expressions.tests.FTimeDeltaTests.test_delta_update" ,
147
+ "expressions.tests.FTimeDeltaTests.test_negative_timedelta_update" ,
148
+ "expressions.tests.ValueTests.test_update_TimeField_using_Value" ,
149
+ "expressions.tests.ValueTests.test_update_UUIDField_using_Value" ,
111
150
"expressions_case.tests.CaseDocumentationExamples.test_conditional_update_example" ,
112
151
"expressions_case.tests.CaseExpressionTests.test_update" ,
113
152
"expressions_case.tests.CaseExpressionTests.test_update_big_integer" ,
@@ -206,6 +245,8 @@ def django_test_expected_failures(self):
206
245
"expressions_case.tests.CaseExpressionTests.test_aggregate_with_expression_as_value" ,
207
246
"expressions_case.tests.CaseExpressionTests.test_aggregation_empty_cases" ,
208
247
"lookup.tests.LookupQueryingTests.test_aggregate_combined_lookup" ,
248
+ "expressions.test_queryset_values.ValuesExpressionsTests.test_chained_values_with_expression" ,
249
+ "expressions.test_queryset_values.ValuesExpressionsTests.test_values_expression_group_by" ,
209
250
"from_db_value.tests.FromDBValueTest.test_aggregation" ,
210
251
"timezones.tests.LegacyDatabaseTests.test_query_aggregation" ,
211
252
"timezones.tests.NewDatabaseTests.test_query_aggregation" ,
@@ -222,6 +263,7 @@ def django_test_expected_failures(self):
222
263
"annotations.tests.NonAggregateAnnotationTestCase.test_full_expression_annotation_with_aggregation" ,
223
264
"annotations.tests.NonAggregateAnnotationTestCase.test_grouping_by_q_expression_annotation" ,
224
265
"annotations.tests.NonAggregateAnnotationTestCase.test_q_expression_annotation_with_aggregation" ,
266
+ "expressions.tests.FieldTransformTests.test_month_aggregation" ,
225
267
"expressions_case.tests.CaseDocumentationExamples.test_conditional_aggregation_example" ,
226
268
# Func not implemented.
227
269
"annotations.tests.NonAggregateAnnotationTestCase.test_custom_functions" ,
@@ -238,6 +280,17 @@ def django_test_expected_failures(self):
238
280
},
239
281
"Exists is not supported on MongoDB." : {
240
282
"annotations.tests.NonAggregateAnnotationTestCase.test_annotation_exists_none_query" ,
283
+ "expressions.tests.BasicExpressionsTests.test_annotation_with_deeply_nested_outerref" ,
284
+ "expressions.tests.BasicExpressionsTests.test_boolean_expression_combined" ,
285
+ "expressions.tests.BasicExpressionsTests.test_boolean_expression_combined_with_empty_Q" ,
286
+ "expressions.tests.BasicExpressionsTests.test_boolean_expression_in_Q" ,
287
+ "expressions.tests.BasicExpressionsTests.test_case_in_filter_if_boolean_output_field" ,
288
+ "expressions.tests.BasicExpressionsTests.test_exists_in_filter" ,
289
+ "expressions.tests.BasicExpressionsTests.test_subquery" ,
290
+ "expressions.tests.ExistsTests.test_filter_by_empty_exists" ,
291
+ "expressions.tests.ExistsTests.test_negated_empty_exists" ,
292
+ "expressions.tests.ExistsTests.test_optimizations" ,
293
+ "expressions.tests.ExistsTests.test_select_negated_empty_exists" ,
241
294
"lookup.tests.LookupTests.test_exact_exists" ,
242
295
"lookup.tests.LookupTests.test_nested_outerref_lhs" ,
243
296
"lookup.tests.LookupQueryingTests.test_filter_exists_lhs" ,
@@ -246,6 +299,19 @@ def django_test_expected_failures(self):
246
299
"annotations.tests.NonAggregateAnnotationTestCase.test_empty_queryset_annotation" ,
247
300
"db_functions.datetime.test_extract_trunc.DateFunctionTests.test_extract_outerref" ,
248
301
"db_functions.datetime.test_extract_trunc.DateFunctionTests.test_trunc_subquery_with_parameters" ,
302
+ "expressions.tests.BasicExpressionsTests.test_annotation_with_outerref" ,
303
+ "expressions.tests.BasicExpressionsTests.test_annotations_within_subquery" ,
304
+ "expressions.tests.BasicExpressionsTests.test_in_subquery" ,
305
+ "expressions.tests.BasicExpressionsTests.test_nested_subquery" ,
306
+ "expressions.tests.BasicExpressionsTests.test_nested_subquery_join_outer_ref" ,
307
+ "expressions.tests.BasicExpressionsTests.test_nested_subquery_outer_ref_2" ,
308
+ "expressions.tests.BasicExpressionsTests.test_nested_subquery_outer_ref_with_autofield" ,
309
+ "expressions.tests.BasicExpressionsTests.test_subquery_filter_by_aggregate" ,
310
+ "expressions.tests.BasicExpressionsTests.test_subquery_filter_by_lazy" ,
311
+ "expressions.tests.BasicExpressionsTests.test_subquery_group_by_outerref_in_filter" ,
312
+ "expressions.tests.BasicExpressionsTests.test_subquery_in_filter" ,
313
+ "expressions.tests.BasicExpressionsTests.test_subquery_references_joined_table_twice" ,
314
+ "expressions.tests.BasicExpressionsTests.test_uuid_pk_subquery" ,
249
315
"lookup.tests.LookupQueryingTests.test_filter_subquery_lhs" ,
250
316
"model_fields.test_jsonfield.TestQuerying.test_nested_key_transform_on_subquery" ,
251
317
"model_fields.test_jsonfield.TestQuerying.test_obj_subquery_lookup" ,
@@ -254,6 +320,9 @@ def django_test_expected_failures(self):
254
320
"annotations.tests.NonAggregateAnnotationTestCase.test_annotation_and_alias_filter_in_subquery" ,
255
321
"annotations.tests.NonAggregateAnnotationTestCase.test_empty_expression_annotation" ,
256
322
"db_functions.comparison.test_coalesce.CoalesceTests.test_empty_queryset" ,
323
+ "expressions.tests.FTimeDeltaTests.test_date_subquery_subtraction" ,
324
+ "expressions.tests.FTimeDeltaTests.test_datetime_subquery_subtraction" ,
325
+ "expressions.tests.FTimeDeltaTests.test_time_subquery_subtraction" ,
257
326
"expressions_case.tests.CaseExpressionTests.test_in_subquery" ,
258
327
"lookup.tests.LookupTests.test_exact_query_rhs_with_selected_columns" ,
259
328
"lookup.tests.LookupTests.test_exact_sliced_queryset_limit_one" ,
@@ -322,6 +391,14 @@ def django_test_expected_failures(self):
322
391
"defer.tests.DeferTests.test_only_baseclass_when_subclass_has_no_added_fields" ,
323
392
"defer.tests.TestDefer2.test_defer_inheritance_pk_chaining" ,
324
393
"defer_regress.tests.DeferRegressionTest.test_ticket_16409" ,
394
+ "expressions.test_queryset_values.ValuesExpressionsTests.test_values_expression" ,
395
+ "expressions.test_queryset_values.ValuesExpressionsTests.test_values_list_expression" ,
396
+ "expressions.test_queryset_values.ValuesExpressionsTests.test_values_list_expression_flat" ,
397
+ "expressions.tests.BasicExpressionsTests.test_annotate_values_aggregate" ,
398
+ "expressions.tests.BasicExpressionsTests.test_outerref_mixed_case_table_name" ,
399
+ "expressions.tests.BasicExpressionsTests.test_outerref_with_operator" ,
400
+ "expressions.tests.IterableLookupInnerExpressionsTests.test_expressions_in_lookups_join_choice" ,
401
+ "expressions.tests.IterableLookupInnerExpressionsTests.test_in_lookup_allows_F_expressions_and_expressions_for_datetimes" ,
325
402
"expressions_case.tests.CaseExpressionTests.test_annotate_with_aggregation_in_condition" ,
326
403
"expressions_case.tests.CaseExpressionTests.test_annotate_with_aggregation_in_predicate" ,
327
404
"expressions_case.tests.CaseExpressionTests.test_annotate_with_aggregation_in_value" ,
@@ -378,6 +455,8 @@ def django_test_expected_failures(self):
378
455
},
379
456
"Test executes raw SQL." : {
380
457
"annotations.tests.NonAggregateAnnotationTestCase.test_raw_sql_with_inherited_field" ,
458
+ "expressions.tests.BasicExpressionsTests.test_annotate_values_filter" ,
459
+ "expressions.tests.BasicExpressionsTests.test_filtering_on_rawsql_that_is_boolean" ,
381
460
"model_fields.test_jsonfield.TestQuerying.test_key_sql_injection_escape" ,
382
461
"model_fields.test_jsonfield.TestQuerying.test_key_transform_raw_expression" ,
383
462
"model_fields.test_jsonfield.TestQuerying.test_nested_key_transform_raw_expression" ,
@@ -417,6 +496,7 @@ def django_test_expected_failures(self):
417
496
"db_functions.datetime.test_extract_trunc.DateFunctionTests.test_trunc_date_func" ,
418
497
"db_functions.datetime.test_extract_trunc.DateFunctionTests.test_trunc_date_none" ,
419
498
"db_functions.datetime.test_extract_trunc.DateFunctionTests.test_trunc_lookup_name_sql_injection" ,
499
+ "expressions.tests.FieldTransformTests.test_multiple_transforms_in_values" ,
420
500
"model_fields.test_datetimefield.DateTimeFieldTests.test_lookup_date_with_use_tz" ,
421
501
"model_fields.test_datetimefield.DateTimeFieldTests.test_lookup_date_without_use_tz" ,
422
502
"timezones.tests.NewDatabaseTests.test_query_convert_timezones" ,
0 commit comments