Skip to content

Commit

Permalink
chore: boron node version test failures (#2747)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken authored Mar 5, 2021
1 parent 8bd9777 commit 2d76492
Show file tree
Hide file tree
Showing 10 changed files with 3,145 additions and 4,470 deletions.
2 changes: 1 addition & 1 deletion lib/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ Db.prototype.collection = function(name, options, callback) {
}

// Merge in all needed options and ensure correct writeConcern merging from db level
options = conditionallyMergeWriteConcern(options, this.s.options, COLLECTION_OPTION_KEYS, true);
options = conditionallyMergeWriteConcern(options, this.s.options);

// Execute
if (options == null || !options.strict) {
Expand Down
9 changes: 7 additions & 2 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,11 @@ function decorateWithExplain(command, explain) {
return { explain: command, verbosity: explain.verbosity };
}

const nodejsMajorVersion = +process.version.split('.')[0].substring(1);
const emitProcessWarning = msg =>
process.emitWarning(msg, { type: 'DeprecationWarning', code: MONGODB_WARNING_CODE });
nodejsMajorVersion <= 6
? process.emitWarning(msg, 'DeprecationWarning', MONGODB_WARNING_CODE)
: process.emitWarning(msg, { type: 'DeprecationWarning', code: MONGODB_WARNING_CODE });
// eslint-disable-next-line no-console
const emitConsoleWarning = msg => console.error(msg);
const emitDeprecationWarning = process.emitWarning ? emitProcessWarning : emitConsoleWarning;
Expand Down Expand Up @@ -836,7 +839,9 @@ const MONGODB_WARNING_CODE = 'MONGODB DRIVER';
*/
function emitWarning(message) {
if (process.emitWarning) {
return process.emitWarning(message, { code: MONGODB_WARNING_CODE });
return nodejsMajorVersion <= 6
? process.emitWarning(message, undefined, MONGODB_WARNING_CODE)
: process.emitWarning(message, { code: MONGODB_WARNING_CODE });
} else {
// Approximate the style of print out on node versions pre 8.x
// eslint-disable-next-line no-console
Expand Down
Loading

0 comments on commit 2d76492

Please sign in to comment.