MongoDB\Driver\ClientEncryption::encrypt
PHP function
Edit on GitHub ✎
(mongodb >=1.7.0)
Encrypt a value
Description
MongoDB\Driver\ClientEncryption::encrypt(mixed $value, array|null $options = null): MongoDB\BSON\Binary
Encrypts the value.
Parameters
valueThe value to be encrypted. Any value that can be inserted into MongoDB can be encrypted using this method.
Return Values
Returns the encrypted value as MongoDB\BSON\Binary object with subtype 6.
Errors/Exceptions
- Throws
MongoDB\Driver\Exception\EncryptionExceptionif an error occurs while encrypting the value
Changelog
| Version | Description |
|---|---|
| PECL mongodb 1.20.0 | Added the "trimFactor" range option. The "sparsity" range option is now optional. |
| PECL mongodb 1.16.0 | Added the "rangeOpts" option. |
| PECL mongodb 1.14.0 | Added the "contentionFactor" and "queryType" options. |