diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 3f8090e9..2aa8b1ff 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -63,7 +63,7 @@ jobs: - name: Start MongoDB uses: supercharge/mongodb-github-action@1.11.0 with: - mongodb-version: 4.4 + mongodb-version: 5.0 - name: Run tests run: > python3 django_repo/tests/runtests.py --settings mongodb_settings -v 2 @@ -74,6 +74,7 @@ jobs: bulk_create dates datetimes + db_functions.datetime db_functions.math empty defer diff --git a/README.md b/README.md index e73006c7..22c8c73c 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,16 @@ DATABASES = { - `DateTimeField` doesn't support microsecond precision. +- The following database functions aren't supported: + - `ExtractQuarter` + - `Now` + - `Sign` + - `TruncDate` + - `TruncTime` + +- The `tzinfo` parameter of the `Trunc` database functions doesn't work + properly because MongoDB converts the result back to UTC. + ## Troubleshooting TODO diff --git a/django_mongodb/features.py b/django_mongodb/features.py index bf04ecf0..481912c9 100644 --- a/django_mongodb/features.py +++ b/django_mongodb/features.py @@ -7,6 +7,8 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_ignore_conflicts = False # Not implemented: https://github.com/mongodb-labs/django-mongodb/issues/8 supports_json_field = False + # BSON Date type doesn't support microsecond precision. + supports_microsecond_precision = False # MongoDB stores datetimes in UTC. supports_timezones = False # Not implemented: https://github.com/mongodb-labs/django-mongodb/issues/7 @@ -17,28 +19,12 @@ class DatabaseFeatures(BaseDatabaseFeatures): # Database defaults not supported: bson.errors.InvalidDocument: # cannot encode object: