title: node js mongodb callback not working - The below piece of code works on my Laptop but does not work on another PC
body: <p>The below piece of code works on my Laptop but does not work on another PC.
      // connecting to mongodb</p>
  
  <pre><code>MongoClient.connect(url, function (err, db) {
    if (err) {
      winston.error('Unable to connect to the mongoDB server. Error:', err);
    } else {
      winston.info('Connection established to', url);
      database = db;
  
       var collection= database.collection('events_dashboard');
  
        collection.findOne({ 
      timestamp_day : deviceTimestamp ,
        machineId : machine.id,
        currentStatus : machine.currentState
    }, function(err, doc){
          winston.info('never came here');
  
        if(doc == null){
                insertRawEvent(machine,rawCollection);
                updateEvent(machine,0);
        }
    });
  
  
  }
  </code></pre>