@@ -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 ) ;
536537const 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
539542const emitConsoleWarning = msg => console . error ( msg ) ;
540543const emitDeprecationWarning = process . emitWarning ? emitProcessWarning : emitConsoleWarning ;
@@ -836,7 +839,9 @@ const MONGODB_WARNING_CODE = 'MONGODB DRIVER';
836839 */
837840function 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