-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: backport emitWarning helper #2743
Conversation
Unify the way we print out messages relating to upcoming changes or potential misuse of the driver. Using the emitWarning API allows users to configure when and how messages are shown. NODE-2317
5582cb3
to
989ae6d
Compare
mergeOptionsAndWriteConcern was not updated to use the new format of writeConcern and was causing the the warning about the deprecation to be emitted regardless of user usage. NODE-3114
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.
Added a suggestion about throwing a warning on type 1 op_msg payloads, like in 4.0. Otherwise LGTM!
lib/core/connection/msg.js
Outdated
@@ -196,7 +197,7 @@ class BinMsg { | |||
while (this.index < this.data.length) { | |||
const payloadType = this.data.readUInt8(this.index++); | |||
if (payloadType === 1) { | |||
console.error('TYPE 1'); | |||
emitWarning('TYPE 1'); // ??? |
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.
emitWarning('TYPE 1'); // ??? | |
// It was decided that no driver makes use of payload type 1 | |
throw new MongoError('OP_MSG Payload Type 1 detected unsupported protocol'); |
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.
LGTM
#2744 is serious impact to many projects, so when the new 3.6 version will be released to npm registry? Thanks. |
We hope to have a release out tomorrow! (March 16) |
@nbbeeken appreciate your guys effort! |
Unify the way we print out messages relating to upcoming changes
or potential misuse of the driver. Using the emitWarning API allows
users to configure when and how messages are shown.
(code from #2740)
NODE-2317, NODE-3114