2013-10-19 10 views
7

MongoDB डब्ल्यू Node.js का उपयोग कर, मैं इसे पाने के बाद किसी आइटम को निकालने के लिए कोशिश कर रहा हूँ पर एक प्रदान की कॉलबैक के बिना एक writeConcern उपयोग नहीं कर सकते .. लेकिन यहMongoDB: त्रुटि: निकालें

  1. में नाकाम रहने के हो, तो मुझे संग्रह मिल (db.collection)
  2. मैं मद (collection.findOne)
  3. मैं संग्रह

क्या मेरी स्क्रिप्ट में गलत क्या है से आइटम निकाल पाते हैं?

exports.revokeRefreshToken = function (refreshToken, callback) { 
    db.collection('oauth_refresh_tokens', function(err, collection) { 
    collection.findOne({'refreshToken': refreshToken}, function(err, item) { 
     db.collection('oauth_refresh_tokens').remove({_id: item._id}); 
     callback(err); 
    }); 
}); 

};

+3

त्रुटि पता चलता है आप निकालने के लिए एक कॉलबैक निर्दिष्ट करने की आवश्यकता शामिल करने के लिए। ऐसा लगता है कि आपको एक नहीं मिला है। – WiredPrairie

+0

धन्यवाद, मैंने फ़ंक्शन को संशोधित किया – erwin

उत्तर

7

मैं निरस्त समारोह संशोधित एक कॉलबैक

exports.revokeRefreshToken = function (refreshToken, callback) { 
    db.collection('oauth_refresh_tokens', function(err, collection) { 
     collection.remove({'refreshToken': refreshToken} , function(err, result) { 
      callback(err); 
     }); 
    }); 
}; 
संबंधित मुद्दे