packages/mongo/lib/utils.js
// Utiliy function to setup logger on db
Utiliy function to setup logger on db
Utiliy function to setup logger on db
function logConnectionEvents (conn) {
  conn.on('disconnected', () => {
    conn.$logger.debug('Disconnected!')
  })
  conn.on('connected', () => {
    conn.$logger.success('Connected!')
  })
  conn.on('connecting', () => {
    conn.$logger.info('Connecting...')
  })
  conn.on('disconnecting', () => {
    conn.$logger.debug('Disconnecting...')
  })
  conn.on('error', (error) => {
    conn.$logger.error(error)
  })
  conn.on('open', () => {
    conn.$logger.debug('Connection opened!')
  })
  conn.on('reconnected', () => {
    conn.$logger.debug('Reconnected!')
  })
  conn.on('fullsetup', () => {
    conn.$logger.debug('ReplicaSet ready!')
  })
}
function logConnectionEvents ( conn ) { conn . on ( 'disconnected' , ( ) => { conn . $logger . debug ( 'Disconnected!' ) } ) conn . on ( 'connected' , ( ) => { conn . $logger . success ( 'Connected!' ) } ) conn . on ( 'connecting' , ( ) => { conn . $logger . info ( 'Connecting...' ) } ) conn . on ( 'disconnecting' , ( ) => { conn . $logger . debug ( 'Disconnecting...' ) } ) conn . on ( 'error' , ( error ) => { conn . $logger . error ( error ) } ) conn . on ( 'open' , ( ) => { conn . $logger . debug ( 'Connection opened!' ) } ) conn . on ( 'reconnected' , ( ) => { conn . $logger . debug ( 'Reconnected!' ) } ) conn . on ( 'fullsetup' , ( ) => { conn . $logger . debug ( 'ReplicaSet ready!' ) } ) }
Utiliy function to setup logger on db
Utiliy function to setup logger on db
// Emitted after getting disconnected from the db. // _readyState: 0 // Emitted when this connection successfully connects to the db. // May be emitted multiple times in reconnected scenarios. // _readyState: 1 // Emitted when connection.{open,openSet}() is executed on this connection. // _readyState: 2 // Emitted when connection.close() was executed. // _readyState: 3 // Emitted when an error occurs on this connection. // Emitted after we connected and onOpen is executed // on all of this connections models. // Emitted after we connected and subsequently disconnected, // followed by successfully another successfull connection. // Emitted in a replica-set scenario, when all nodes specified // in the connection string are connected.