Skip to content

Commit e5d736e

Browse files
committed
Update docs for createEncryptedCollection()
1 parent 521855d commit e5d736e

File tree

3 files changed

+27
-18
lines changed

3 files changed

+27
-18
lines changed

docs/reference/exception-classes.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ MongoDB\\Exception\\CreateEncryptedCollectionException
3636
.. phpclass:: MongoDB\\Exception\\CreateEncryptedCollectionException
3737

3838
Thrown by :phpmethod:`MongoDB\\Database::createEncryptedCollection()` if any
39-
error is encountered while creating data keys or invoking
40-
:phpmethod:`createCollection() <MongoDB\\Database::createCollection()>`. The
39+
error is encountered while creating data keys or creating the collection. The
4140
original exception and modified ``encryptedFields`` option can be accessed
4241
via the ``getPrevious()`` and ``getEncryptedFields()`` methods, respectively.
4342

docs/reference/method/MongoDBDatabase-createEncryptedCollection.txt

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ MongoDB\\Database::createEncryptedCollection()
1212
:depth: 1
1313
:class: singlecol
1414

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+
1523
Definition
1624
----------
1725

@@ -23,11 +31,12 @@ Definition
2331

2432
function createEncryptedCollection(string $collectionName, MongoDB\Driver\ClientEncryption $clientEncryption, string $kmsProvider, ?array $masterKey, array $options): array
2533

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
2936
: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.
3140

3241
This method does not affect any auto encryption settings on existing
3342
:phpclass:`MongoDB\\Client` objects. Users must configure auto encryption
@@ -44,17 +53,18 @@ Definition
4453
Return Values
4554
-------------
4655

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.
5060

5161
Errors/Exceptions
5262
-----------------
5363

5464
: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.
5868

5969
.. include:: /includes/extracts/error-invalidargumentexception.rst
6070

@@ -96,7 +106,7 @@ an encrypted string field.
96106
);
97107

98108
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
100110
``$encryptedFields['fields'][0]['keyId']`` will contain a
101111
:php:`MongoDB\\BSON\\Binary <class.mongodb-bson-binary>` object with subtype 4
102112
(i.e. UUID).

src/Database.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,13 @@ public function createCollection(string $collectionName, array $options = [])
303303
* where "keyId" is null. A copy of the modified "encryptedFields" option
304304
* will be returned in addition to the result from creating the collection.
305305
*
306-
* If any error is encountered while creating data keys or creating the
307-
* collection, a CreateEncryptedCollectionException will be thrown. The
308-
* original exception and modified "encryptedFields" option can be accessed
309-
* via the getPrevious() and getEncryptedFields() methods, respectively.
306+
* If any error is encountered creating data keys or the collection, a
307+
* CreateEncryptedCollectionException will be thrown. The original exception
308+
* and modified "encryptedFields" option can be accessed via the
309+
* getPrevious() and getEncryptedFields() methods, respectively.
310310
*
311311
* @see CreateCollection::__construct() for supported options
312-
* @return array A tuple consisting of the result from creating the collection and the modified "encryptedFields" option
312+
* @return array A tuple containing the command result document from creating the collection and the modified "encryptedFields" option
313313
* @throws InvalidArgumentException for parameter/option parsing errors
314314
* @throws CreateEncryptedCollectionException for any errors creating data keys or creating the collection
315315
*/

0 commit comments

Comments
 (0)