-
Type: Sub-task
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
Use Case
As a driver engineer,
I want our bindings to behave intuitively and follow Javascript norms,
So that they are easy to use.
https://github.com/mongodb/libmongocrypt/commit/b6292cc8177654c1e07391728865db0dc46f4f60 changed the logic so that we check that when Buffer options are provided to our FLE bindings, we check that the value is the expected type but we disallow undefined. This breaks code like the following:
mongoClientEncryption.makeDataKeyContext(..., { keyMaterial: undefined }) // keymaterial is optional
We rely on this in our JS logic in the driver, and while we could fix it there it makes more sense to fix it in C++ because
- that was the old behavior
- that is typically how JS code is written
User Impact
n/a internal refactor
Dependencies
n/a
Unknowns
n/a
Acceptance Criteria
Implementation Requirements
- Look through `mongocrypt.cc` for usages of `Options::Has()` when checking if a Buffer option is provided. For each usage, determine whether or now we should be checking for property existence or checking the value for the expected type (`'a' in obj` versus `typeof obj.a === 'string'`).
- For each option, adjust the logic to use `Object::Get(...)::IsUndefined()` instead of `Object::Has()`. This tests that the value of the object is undefined or unset.
Testing Requirements
- Update the existing bindings tests to confirm that for each option, we allow a user to specify `undefined` explicitly.
Documentation Requirements
n/a
Follow Up Requirements
Release mongodb-client-encryption@6.0.0-alpha.3 with the changes for the driver.