-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: 2.1.1
-
Component/s: None
-
None
-
None
-
PHP Drivers
-
None
-
None
-
None
-
None
-
None
-
None
In the Manager constructor, when setting the autoEncryption.encryptedFieldsMap with a keyId other than a BSON Binary UUID, the error message mention the BSON type ID, it should show the type name, and maybe the invalid value.
$client = new \MongoDB\Client( 'mongodb://localhost:27017,localhost:27018,localhost:27019', [], [ 'autoEncryption' => [ 'keyVaultNamespace' => 'tests.keyVault', 'kmsProviders' => [ 'local' => ['key' => new \MongoDB\BSON\Binary(random_bytes(96))], ], 'encryptedFieldsMap' => [ 'tests.coll' => [ 'fields' => [ [ 'path' => 'encryptedField', 'bsonType' => 'int', 'keyId' => 'invalid', ], ], ] ], ], ], ); $client->getCollection('tests', 'coll')->insertOne([ 'encryptedField' => 42, ]);
Error message:
MongoDB\Driver\Exception\BulkWriteException: Bulk write failed due to previous MongoDB\Driver\Exception\EncryptionException: expected 'fields.keyId' to be type binary, got: 2
Should be
MongoDB\Driver\Exception\BulkWriteException: Bulk write failed due to previous MongoDB\Driver\Exception\EncryptionException: expected 'fields.keyId' to be type binary, got: (string) "invalid"
- related to
-
PHPORM-363 The encryptedFieldsMap exported by the command must contain the keyId
-
- Needs Triage
-