From 03b7c93f55bd3eec217d91a49ec4e917abb11dd4 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Wed, 15 Oct 2025 19:29:24 -0400 Subject: [PATCH] Document that $ and . aren't supported in Field.db_column --- docs/ref/models/fields.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/ref/models/fields.rst b/docs/ref/models/fields.rst index 29cce684c..d968c0882 100644 --- a/docs/ref/models/fields.rst +++ b/docs/ref/models/fields.rst @@ -39,6 +39,18 @@ A few notes about some of the other fields: - Similarly, all :class:`~django.db.models.DurationField` values are stored as :class:`bson.int64.Int64`. +Model field options +=================== + +Some notes about model field options: + +- Dollar signs and periods (``$`` and ``.``) are not supported in + :attr:`Field.db_column ` because these field + names are :doc:`discouraged by MongoDB + `. Querying fields with these + characters requires the ``$getField`` operator, which prevents queries from + using indexes. + MongoDB-specific model fields =============================