@@ -356,6 +356,10 @@ Optional arguments:
356356 users only. The default values for these options are suitable for the majority
357357 of use cases, and should only be modified if your use case requires it.
358358
359+ .. note ::
360+
361+ Queryable encryption is only supported in MongoDB version 8.0 and later.
362+
359363Example:
360364
361365.. code-block :: php
@@ -373,9 +377,50 @@ Example:
373377 public string $name;
374378 }
375379
380+ The ``#[Encrypt] `` attribute can be added to a class with `#[EmbeddedDocument] `_.
381+ This will encrypt the entire embedded document, in the field that contains it.
382+ Queryable encryption is not supported for embedded documents, so the ``queryType ``
383+ argument is not applicable. Encrypted embedded documents are stored as a binary
384+ value in the parent document.
385+
386+ .. code-block :: php
387+
388+ <?php
389+
390+ use Doctrine\ODM\MongoDB\Mapping\Annotations\Encrypt;
391+
392+ #[Encrypt]
393+ #[EmbeddedDocument]
394+ class CreditCard
395+ {
396+ #[Field]
397+ public string $number;
398+
399+ #[Field]
400+ public string $expiryDate;
401+ }
402+
403+ #[Document]
404+ class User
405+ {
406+ #[EmbedOne(targetDocument: CreditCard::class)]
407+ public CreditCard $creditCard;
408+ }
409+
376410 For more details, refer to the MongoDB documentation on
377411`Queryable Encryption <https://www.mongodb.com/docs/manual/core/queryable-encryption/fundamentals/encrypt-and-query/ >`_.
378412
413+
414+ .. note ::
415+
416+ The encrypted collection must be created with the `Schema Manager `_ before
417+ before inserting documents.
418+
419+ .. note ::
420+
421+ Due to the way the encrypted fields map is generated, the queryable encryption
422+ is not compatible with ``SINGLE_COLLECTION `` inheritance.
423+
379424#[Field]
380425--------
381426
@@ -1439,5 +1484,6 @@ root class specified in the view mapping.
14391484.. _DBRef : https://docs.mongodb.com/manual/reference/database-references/#dbrefs
14401485.. _geoNear command : https://docs.mongodb.com/manual/reference/command/geoNear/
14411486.. _MongoDB\B SON\O bjectId : https://www.php.net/class.mongodb-bson-objectid
1487+ .. _Schema Manager : ../reference/migrating-schemas
14421488.. |FQCN | raw :: html
14431489 <abbr title="Fully-Qualified Class Name">FQCN</abbr>
0 commit comments