簡體   English   中英

node js mongodb 回調不起作用 - 下面的代碼在我的筆記本電腦上工作,但在另一台 PC 上不起作用

[英]node js mongodb callback not working - The below piece of code works on my Laptop but does not work on another PC

下面的一段代碼適用於我的筆記本電腦,但不適用於另一台 PC。 // 連接到mongodb

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);
      }
  });


}

那么你是先在你的 PC 上啟動 mongodb 的嗎? 哪個可能會在您的筆記本電腦中自動啟動?

在徹底比較了我的筆記本電腦和 PC 的規格后,我們發現 PC 上只有 windows 7 ,而不是 windows 7 service pack 1。安裝 SP1 后,它開始工作了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM