@@ -12,6 +12,14 @@ MongoDB\\Database::createEncryptedCollection()
12
12
:depth: 1
13
13
:class: singlecol
14
14
15
+ .. note::
16
+
17
+ Queryable Encryption is in public preview and available for evaluation
18
+ purposes. It is not yet recommended for production deployments as breaking
19
+ changes may be introduced. See the
20
+ `Queryable Encryption Preview <https://www.mongodb.com/blog/post/mongodb-releases-queryable-encryption-preview/>`_
21
+ blog post for more information.
22
+
15
23
Definition
16
24
----------
17
25
@@ -23,11 +31,12 @@ Definition
23
31
24
32
function createEncryptedCollection(string $collectionName, MongoDB\Driver\ClientEncryption $clientEncryption, string $kmsProvider, ?array $masterKey, array $options): array
25
33
26
- This method wraps :phpmethod:`MongoDB\\Database::createCollection()` and will
27
- automatically create data keys for any encrypted fields where the ``keyId``
28
- option is ``null``. Data keys will be created using
34
+ This method will automatically create data keys for any encrypted fields
35
+ where ``keyId`` is ``null``. Data keys will be created using
29
36
:php:`MongoDB\\Driver\\ClientEncryption::createDataKey() <mongodb-driver-clientencryption.createdatakey>`
30
- and the provided ``$kmsProvider`` and ``$masterKey`` parameters.
37
+ and the provided ``$kmsProvider`` and ``$masterKey`` parameters. A copy of
38
+ the modified ``encryptedFields`` option will be returned in addition to the
39
+ result from creating the collection.
31
40
32
41
This method does not affect any auto encryption settings on existing
33
42
:phpclass:`MongoDB\\Client` objects. Users must configure auto encryption
@@ -44,17 +53,18 @@ Definition
44
53
Return Values
45
54
-------------
46
55
47
- A tuple consisting of the result from
48
- :phpmethod:`MongoDB\\Database::createCollection()` and the modified
49
- ``encryptedFields`` option.
56
+ A tuple (i.e. two-element array) containing the result document from the
57
+ :manual:`create </reference/command/create>` command (an array or object
58
+ according to the ``typeMap`` option) and the modified ``encryptedFields``
59
+ option.
50
60
51
61
Errors/Exceptions
52
62
-----------------
53
63
54
64
:phpclass:`MongoDB\\Exception\\CreateEncryptedCollectionException` if any error
55
- is encountered while creating data keys or invoking ``createCollection()`` . The
56
- original exception and modified ``encryptedFields`` option can be accessed via
57
- the ``getPrevious()`` and ``getEncryptedFields()`` methods, respectively.
65
+ is encountered creating data keys or the collection . The original exception and
66
+ modified ``encryptedFields`` option can be accessed via the ``getPrevious()``
67
+ and ``getEncryptedFields()`` methods, respectively.
58
68
59
69
.. include:: /includes/extracts/error-invalidargumentexception.rst
60
70
@@ -96,7 +106,7 @@ an encrypted string field.
96
106
);
97
107
98
108
If the encrypted collection was successfully created, ``$result`` will contain
99
- the return value from :phpmethod:`MongoDB\\Database::createCollection()` and
109
+ the response document from the ``create`` command and
100
110
``$encryptedFields['fields'][0]['keyId']`` will contain a
101
111
:php:`MongoDB\\BSON\\Binary <class.mongodb-bson-binary>` object with subtype 4
102
112
(i.e. UUID).
0 commit comments