Skip to content

Commit 73fddca

Browse files
authored
DRIVERS-2505 clarify type expectations in prose test (#1409)
* clarify type expectation applies to encoded BSON type The BSON type differs from the input type. The input type may be a language native type (e.g. an Int64 wrapper class). * use long and int in clarification int32/int64 handling may be more likely to cause confusion in implementation * add note clarifying returned type may not match input type
1 parent ab66eaf commit 73fddca

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

source/client-side-encryption/tests/README.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2807,7 +2807,7 @@ Each test listed in the cases below must pass for all supported data types unles
28072807
28082808
Case 1: can decrypt a payload
28092809
`````````````````````````````
2810-
Use ``clientEncryption.encrypt()`` to encrypt the value 6. Ensure the type matches with the type of the encrypted field. For example, if the encrypted field is ``encryptedDoubleNoPrecision`` encrypt the double value 6.0.
2810+
Use ``clientEncryption.encrypt()`` to encrypt the value 6. Ensure the encoded BSON type matches the type of the encrypted field. For example, if the encrypted field is ``encryptedLong`` encrypt the 64-bit BSON long value 6, not the 32-bit BSON int value 6.
28112811

28122812
Store the result in ``insertPayload``.
28132813

@@ -2823,6 +2823,11 @@ Encrypt with the matching ``RangeOpts`` listed in `Test Setup: RangeOpts`_ and t
28232823
28242824
Use ``clientEncryption`` to decrypt ``insertPayload``. Assert the returned value equals 6.
28252825

2826+
.. note::
2827+
2828+
The type returned by ``clientEncryption.decrypt()`` may differ from the input type to ``clientEncryption.encrypt()`` depending on how the driver unmarshals BSON numerics to language native types.
2829+
Example: a driver may unmarshal a BSON long to a numeric type that does not distinguish between int64 and int32.
2830+
28262831
Case 2: can find encrypted range and return the maximum
28272832
```````````````````````````````````````````````````````
28282833
Use ``clientEncryption.encryptExpression()`` to encrypt this query:

0 commit comments

Comments
 (0)