-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(NODE-6173): add rangeV2 feature flag toggle to Node.js bindings #809
Conversation
@@ -514,6 +514,10 @@ MongoCrypt::MongoCrypt(const CallbackInfo& info) | |||
mongocrypt_setopt_bypass_query_analysis(_mongo_crypt.get()); | |||
} | |||
|
|||
if (options.Get("rangeV2").ToBoolean()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if rangeV2 is provided? Does it return a false? If it can return null an additional check would be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I fully understand your question (probably a "not" missing somewhere?), but this is the equivalent of if (!!options.rangeV2)
in JS 鈥撀爓e do a similar check right above this one for bypassQueryAnalysis
. This type of check is fine for boolean values, including optional ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry, just found out that there was a not missing in my question. I was asking because we do options.get(flag).ToBoolean(), so if flag is not provided (is nullable in the ts definition) it would return null and fail with a NPE.
But if this is not the case, LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Null
and Undefined
are represented in Node-API as distinct values, not a C/C++ nullptr
, so that's all good, and .ToBoolean()
corresponds directly to the JS standard ToBoolean()
operation 馃檪
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears this option will just "pass through" for ClientEncryption
but AutoEncryption
would need to support it explicitly, will you be needing that?
@nbbeeken Yeah, not ideal for this that |
See the ticket for motivation/why it would be convenient to have this earlier than the 'main' range V2 work 馃檪