Skip to content

Commit 4acc5ab

Browse files
committed
Add optional dependency + doc updates
1 parent 1af38d8 commit 4acc5ab

File tree

11 files changed

+46
-53
lines changed

11 files changed

+46
-53
lines changed

docs/source/howto/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ Project configuration
1111
:maxdepth: 1
1212

1313
contrib-apps
14-
encryption
14+
queryable-encryption

docs/source/howto/encryption.rst renamed to docs/source/howto/queryable-encryption.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ your Django settings.
5454
DATABASES["other"]["KMS_CREDENTIALS"] = encryption.KMS_CREDENTIALS
5555
DATABASE_ROUTERS = [encryption.EncryptedRouter()]
5656

57-
You are now ready to use :doc:`encrypted fields </topics/encrypted-fields>` in your Django project.
57+
You are now ready to use :doc:`Queryable Encryption </topics/queryable-encryption>` in your Django project.
5858

5959

6060
Helper classes and settings

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Models
4545
**Topic guides:**
4646

4747
- :doc:`topics/embedded-models`
48-
- :doc:`topics/encrypted-fields`
48+
- :doc:`topics/queryable-encryption`
4949

5050
Forms
5151
=====

docs/source/intro/configure.rst

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -172,21 +172,6 @@ normal models by :djadmin:`dumpdata`::
172172
(If you've used the :djadmin:`startproject` template, this line is already
173173
present.)
174174

175-
Queryable Encryption
176-
--------------------
177-
178-
If you intend to use :doc:`encrypted fields </topics/encrypted-fields>`, you may
179-
optionally configure the :setting:`DATABASE_ROUTERS` setting so that collections
180-
for encrypted fields are created in an encrypted database.
181-
182-
`Router configuration <https://docs.djangoproject.com/en/stable/topics/db/multi-db/#database-routers>`__
183-
is unique to each project and beyond the scope of Django MongoDB Backend, but an
184-
example is included in the :doc:`encryption helpers </howto/encryption>`
185-
that routes collection operations for encrypted fields to a database named
186-
"other"::
187-
188-
DATABASE_ROUTERS = ["django_mongodb_backend.encryption.EncryptedRouter"]
189-
190175
Congratulations, your project is ready to go!
191176

192177
.. seealso::

docs/source/intro/install.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,11 @@ of Django. For example, to get the latest compatible release for Django 5.2.x:
1414
The minor release number of Django doesn't correspond to the minor release
1515
number of ``django-mongodb-backend``. Use the latest minor release of each.
1616

17+
If you plan to use :doc:`/topics/queryable-encryption/`, you will also need to install
18+
the optional dependencies:
19+
20+
.. code-block:: bash
21+
22+
$ pip install --pre django-mongodb-backend[encryption]==5.2.*
23+
1724
Next, you'll have to :doc:`configure your project <configure>`.

docs/source/ref/django-admin.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ Available commands
3333

3434
.. django-admin:: get_encrypted_fields_map
3535

36-
Creates a schema map for the encrypted fields in your models. This
37-
map can be provided to
38-
:class:`~pymongo.encryption_options.AutoEncryptionOpts` for use with
39-
:class:`~pymongo.encryption.ClientEncryption`.
36+
Creates a schema map for encrypted fields that can be used with
37+
:class:`~pymongo.encryption_options.AutoEncryptionOpts` to configure
38+
an encrypted client.
4039

4140
.. django-admin-option:: --database DATABASE
4241

43-
Specifies the database to use to generate an encrypted fields map.
42+
Specifies the database to use.
4443
Defaults to ``default``.
44+
45+
.. TODO: Clarify how database specified could affect output.

docs/source/ref/models/fields.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,8 @@ These indexes use 0-based indexing.
314314

315315
Stores an :class:`~bson.objectid.ObjectId`.
316316

317+
.. _encrypted-fields:
318+
317319
Encrypted fields
318320
----------------
319321

@@ -351,13 +353,10 @@ they encrypt the data before storing it in the database.
351353

352354
.. _encrypted-fields-unsupported-fields:
353355

354-
Unsupported fields
355-
~~~~~~~~~~~~~~~~~~
356+
Fields unsupported with Queryable Encryption
357+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
356358

357359
The following fields are supported by Django MongoDB Backend but not by Queryable Encryption.
358360

359-
+---------------------------------------+--------------------------------------------------+
360-
| ``EncryptedDurationField`` | :class:`~django.db.models.DurationField` |
361-
+---------------------------------------+--------------------------------------------------+
362-
| ``EncryptedSlugField`` | :class:`~django.db.models.SlugField` |
363-
+---------------------------------------+--------------------------------------------------+
361+
- :class:`~django.db.models.DurationField`
362+
- :class:`~django.db.models.SlugField`

docs/source/topics/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ know:
1010

1111
cache
1212
embedded-models
13-
encrypted-fields
1413
known-issues
14+
queryable-encryption

docs/source/topics/encrypted-fields.rst renamed to docs/source/topics/queryable-encryption.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
Encrypted fields
2-
================
1+
Queryable Encryption
2+
====================
33

4-
Use :class:`~django_mongodb_backend.models.EncryptedModel` and
5-
:mod:`~django_mongodb_backend.fields` to structure
4+
Use :ref:`encrypted fields <encrypted-fields>` to store sensitive data in MongoDB
65
your data using `Queryable Encryption <https://www.mongodb.com/docs/manual/core/queryable-encryption/>`_.
76

87
.. _encrypted-field-example:
@@ -51,7 +50,7 @@ the patient data looks like this:
5150
ssn: Binary.createFromBase64('DkrbD67ejkt2u…', 6),
5251
}
5352
54-
Querying Encrypted Fields
53+
Querying encrypted fields
5554
-------------------------
5655

5756
You can query encrypted fields using a `limited set of

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ classifiers = [
3434
]
3535

3636
[project.optional-dependencies]
37-
docs = [ "sphinx>=7"]
37+
docs = ["sphinx>=7"]
38+
encryption = ["pymongo[encryption]"]
3839

3940
[project.urls]
4041
Homepage = "https://www.mongodb.org"

0 commit comments

Comments
 (0)