@@ -533,8 +533,11 @@ function decorateWithExplain(command, explain) {
533
533
return { explain : command , verbosity : explain . verbosity } ;
534
534
}
535
535
536
+ const nodejsMajorVersion = + process . version . split ( '.' ) [ 0 ] . substring ( 1 ) ;
536
537
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 } ) ;
538
541
// eslint-disable-next-line no-console
539
542
const emitConsoleWarning = msg => console . error ( msg ) ;
540
543
const emitDeprecationWarning = process . emitWarning ? emitProcessWarning : emitConsoleWarning ;
@@ -836,7 +839,9 @@ const MONGODB_WARNING_CODE = 'MONGODB DRIVER';
836
839
*/
837
840
function emitWarning ( message ) {
838
841
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 } ) ;
840
845
} else {
841
846
// Approximate the style of print out on node versions pre 8.x
842
847
// eslint-disable-next-line no-console
0 commit comments