@@ -12,8 +12,12 @@ Encrypted Collection Management
12
12
:depth: 2
13
13
:class: singlecol
14
14
15
- In this guide, you can learn how to manage your encrypted collections,
16
- and the storage and write costs of {+qe+}.
15
+ Every encrypted field in a collection adds writes to insert,
16
+ update, and delete operations. It also requires additional storage,
17
+ since MongoDB maintains an index of encrypted fields. This section
18
+ lists the writes per operation and explains how to compact encrypted
19
+ collection indexes, so that you can plan accordingly to minimize write
20
+ and storage costs.
17
21
18
22
Overview
19
23
--------
@@ -24,9 +28,9 @@ fields.
24
28
25
29
With {+qe+}, a given plaintext value always encrypts to a different
26
30
ciphertext, while still remaining queryable. To enable
27
- this functionality, {+qe+} uses four data structures:
31
+ this functionality, {+qe+} uses three data structures:
28
32
29
- - Three metadata collections
33
+ - Two metadata collections
30
34
- A field in every document in the encrypted collection called ``__safeContent__``
31
35
32
36
.. important::
@@ -37,11 +41,10 @@ this functionality, {+qe+} uses four data structures:
37
41
Metadata Collections
38
42
--------------------
39
43
40
- When you create an encrypted collection using {+qe+} , MongoDB creates three
44
+ When you create an encrypted collection, MongoDB creates two
41
45
metadata collections:
42
46
43
47
- ``enxcol_.<collectionName>.esc``, referred to as ``ESC``
44
- - ``enxcol_.<collectionName>.ecc``, referred to as ``ECC``
45
48
- ``enxcol_.<collectionName>.ecoc``, referred to as ``ECOC``
46
49
47
50
.. example::
@@ -50,29 +53,25 @@ metadata collections:
50
53
following metadata collections:
51
54
52
55
- ``enxcol_.patients.esc``
53
- - ``enxcol_.patients.ecc``
54
56
- ``enxcol_.patients.ecoc``
55
57
56
58
57
- When you insert documents with encrypted fields that you wish to query on ,
59
+ When you insert documents with a queryable encrypted field ,
58
60
MongoDB updates the metadata collections to maintain an index
59
- that enables you to query. MongoDB refers to this as "indexed field". This
60
- comes at a cost in storage and write speed.
61
+ that enables querying. The field becomes an "indexed field". This
62
+ comes at a cost in storage and write speed for every such field .
61
63
62
64
Storage Costs
63
65
-------------
64
66
65
67
Storage and write costs increase based on the number of indexed fields
66
68
per document.
67
69
68
- .. important:: Technical Preview
69
-
70
- MongoDB's guidance during the technical preview is to expect two to
71
- three times the storage requirement for a {+qe+} collection and
72
- associated metadata collections. For example, a 1 GB collection may
73
- have a storage requirement of 2-3 GB for associated metadata collections.
70
+ .. important::
74
71
75
- This guidance will be tuned in a future release.
72
+ Expect a {+qe+} collection to have 2-3 times the storage requirements
73
+ of the documents, to account for metadata collections. For example, a
74
+ 1 GB collection may have a storage requirement of 2-3 GB.
76
75
77
76
Write Costs
78
77
-----------
@@ -97,11 +96,10 @@ metadata collections.
97
96
Update Operations
98
97
~~~~~~~~~~~~~~~~~
99
98
100
- When updating a document, each indexed field requires four writes to
99
+ When updating a document, each indexed field requires three writes to
101
100
metadata collections.
102
101
103
102
- One write to ``ESC``
104
- - One write to ``ECC``
105
103
- Two writes to ``ECOC``
106
104
107
105
@@ -110,45 +108,44 @@ metadata collections.
110
108
Updating a document with two indexed fields requires:
111
109
112
110
- One write to the encrypted collection.
113
- - Eight writes to the metadata collections.
111
+ - Six writes to the metadata collections.
114
112
115
113
116
114
Delete Operations
117
115
~~~~~~~~~~~~~~~~~
118
116
119
- When deleting a document, each indexed field requires two writes to the
117
+ When deleting a document, each indexed field requires one write to the
120
118
metadata collections.
121
119
122
- - One write to ``ECC``
123
120
- One write to ``ECOC``
124
121
125
122
126
123
.. example::
127
124
128
125
Deleting a document with two indexed fields requires:
129
126
130
- - One write into the encrypted collection.
131
- - Four writes to the metadata collections.
127
+ - One write to the encrypted collection.
128
+ - Two writes to the metadata collections.
132
129
133
130
134
131
.. _qe-index-compaction:
135
132
136
133
Index Compaction
137
134
----------------
138
135
139
- .. important:: Technical Preview
136
+ .. important::
140
137
141
- You are required to run index compaction during the technical preview.
142
- MongoDB plans to automatically run index compaction in a future release.
138
+ You must manually run index compaction. MongoDB will automatically
139
+ run index compaction in a future release.
143
140
144
141
As you insert, update, and delete documents, the metadata collections
145
- change and grow. Index compaction is a process that prunes the metadata
146
- collections and reduces their size.
142
+ change and grow. Index compaction prunes the metadata collections and
143
+ reduces their size.
147
144
148
- You should run index compaction when the size of ``ECOC`` exceeds 1 GB.
145
+ Run index compaction when the size of ``ECOC`` exceeds 1 GB.
149
146
150
147
You can check the size of your collections using :binary:`~bin.mongosh`
151
- and issuing the `` db.collection.totalSize()` ` command.
148
+ and issuing the :method:` db.collection.totalSize()` command.
152
149
153
150
.. example::
154
151
0 commit comments