Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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