Skip to content

Commit 2d76492

Browse files
authored
chore: boron node version test failures (#2747)
1 parent 8bd9777 commit 2d76492

File tree

10 files changed

+3145
-4470
lines changed

10 files changed

+3145
-4470
lines changed

lib/db.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ Db.prototype.collection = function(name, options, callback) {
440440
}
441441

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

445445
// Execute
446446
if (options == null || !options.strict) {

lib/utils.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,11 @@ function decorateWithExplain(command, explain) {
533533
return { explain: command, verbosity: explain.verbosity };
534534
}
535535

536+
const nodejsMajorVersion = +process.version.split('.')[0].substring(1);
536537
const emitProcessWarning = msg =>
537-
process.emitWarning(msg, { type: 'DeprecationWarning', code: MONGODB_WARNING_CODE });
538+
nodejsMajorVersion <= 6
539+
? process.emitWarning(msg, 'DeprecationWarning', MONGODB_WARNING_CODE)
540+
: process.emitWarning(msg, { type: 'DeprecationWarning', code: MONGODB_WARNING_CODE });
538541
// eslint-disable-next-line no-console
539542
const emitConsoleWarning = msg => console.error(msg);
540543
const emitDeprecationWarning = process.emitWarning ? emitProcessWarning : emitConsoleWarning;
@@ -836,7 +839,9 @@ const MONGODB_WARNING_CODE = 'MONGODB DRIVER';
836839
*/
837840
function emitWarning(message) {
838841
if (process.emitWarning) {
839-
return process.emitWarning(message, { code: MONGODB_WARNING_CODE });
842+
return nodejsMajorVersion <= 6
843+
? process.emitWarning(message, undefined, MONGODB_WARNING_CODE)
844+
: process.emitWarning(message, { code: MONGODB_WARNING_CODE });
840845
} else {
841846
// Approximate the style of print out on node versions pre 8.x
842847
// eslint-disable-next-line no-console

0 commit comments

Comments
 (0)