@@ -21,14 +21,11 @@ Definition
21
21
22
22
.. code-block:: php
23
23
24
- function createEncryptedCollection(string $collectionName, ClientEncryption $clientEncryption, string $kmsProvider, ?array $masterKey, array $options = [] ): array
24
+ function createEncryptedCollection(string $collectionName, ClientEncryption $clientEncryption, string $kmsProvider, ?array $masterKey, array $options): array
25
25
26
- This method wraps :phpmethod:`MongoDB\\Database::createCollection()` with
27
- additional functionality. Unlike ``createCollection()`, this method requires
28
- that the ``encryptedFields`` option be specified.
29
-
30
- This function will automatically create data keys for any encrypted fields
31
- where the ``keyId`` option is ``null``. Data keys will be created using
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
32
29
:php:`MongoDB\\Driver\\ClientEncryption::createDataKey() <mongodb-driver-clientencryption.createdatakey>`
33
30
and the provided ``$kmsProvider`` and ``$masterKey`` parameters.
34
31
@@ -40,13 +37,9 @@ Definition
40
37
41
38
.. include:: /includes/apiargs/MongoDBDatabase-method-createEncryptedCollection-param.rst
42
39
43
- The ``$options`` parameter supports the following options:
44
-
45
- .. include:: /includes/apiargs/MongoDBDatabase-method-createEncryptedCollection-option.rst
46
-
47
- Note that not all options are available on all versions of MongoDB. Refer to
48
- the :manual:`create </reference/command/create>` command reference in the
49
- MongoDB manual for compatibility considerations.
40
+ The ``$options`` parameter supports the same options as
41
+ :phpmethod:`MongoDB\\Database::createCollection()`. The ``encryptedFields``
42
+ option is required.
50
43
51
44
Return Values
52
45
-------------
@@ -58,11 +51,10 @@ A tuple consisting of the result from
58
51
Errors/Exceptions
59
52
-----------------
60
53
61
- :phpclass:`MongoDB\\Driver\\Exception\\CreateEncryptedCollectionException` if
62
- any error is encountered while creating data keys or invoking
63
- ``createCollection()``. The original exception and modified ``encryptedFields``
64
- option can be accessed via ``getPrevious()`` and ``getEncryptedFields()``,
65
- respectively.
54
+ :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.
66
58
67
59
.. include:: /includes/extracts/error-invalidargumentexception.rst
68
60
@@ -104,12 +96,10 @@ an encrypted string field.
104
96
);
105
97
106
98
If the encrypted collection was successfully created, ``$result`` will contain
107
- the return value from :phpmethod:`MongoDB\\Database::createCollection()` (i.e.
108
- :manual:`create </reference/command/create>` command response) and
109
- ``$encryptedFields['fields'][0]['keyId']`` will contain the return value from
110
- :php:`MongoDB\\Driver\\ClientEncryption::createDataKey() <mongodb-driver-clientencryption.createdatakey>`
111
- (i.e. a :php:`MongoDB\\BSON\\Binary <class.mongodb-bson-binary>` with subtype 4,
112
- UUID).
99
+ the return value from :phpmethod:`MongoDB\\Database::createCollection()` and
100
+ ``$encryptedFields['fields'][0]['keyId']`` will contain a
101
+ :php:`MongoDB\\BSON\\Binary <class.mongodb-bson-binary>` object with subtype 4
102
+ (i.e. UUID).
113
103
114
104
See Also
115
105
--------
0 commit comments