lib/operations/mongo_client_ops.js
function collectEvents(mongoClient, topology) {
  let MongoClient = loadClient();
  const collectedEvents = [];

  if (mongoClient instanceof MongoClient) {
    monitoringEvents.forEach(event => {
      topology.on(event, (object1, object2) => {
        if (event === 'open') {
          collectedEvents.push({ event: event, object1: mongoClient });
        } else {
          collectedEvents.push({ event: event, object1: object1, object2: object2 });
        }
      });
    });
  }

  return collectedEvents;
}
function collectEvents(mongoClient, topology) {
  let MongoClient = loadClient();
  const collectedEvents = [];

  if (mongoClient instanceof MongoClient) {
    monitoringEvents.forEach(event => {
      topology.on(event, (object1, object2) => {
        if (event === 'open') {
          collectedEvents.push({ event: event, object1: mongoClient });
        } else {
          collectedEvents.push({ event: event, object1: object1, object2: object2 });
        }
      });
    });
  }

  return collectedEvents;
}
function collectEvents ( mongoClient , topology ) { let MongoClient = loadClient ( ) ; const collectedEvents = [ ] ; if ( mongoClient instanceof MongoClient ) { monitoringEvents . forEach ( event => { topology . on ( event , ( object1 , object2 ) => { if ( event === 'open' ) { collectedEvents . push ( { event : event , object1 : mongoClient } ) ; } else { collectedEvents . push ( { event : event , object1 : object1 , object2 : object2 } ) ; } } ) ; } ) ; } return collectedEvents ; }
Collect all events in order from SDAM
Collect all events in order from SDAM