using MongoDB w node.js, I am trying to delete an item after searching for it .. but it does not work
- I get a collection (db.collection)
- I find the item (collection.findOne)
- I remove an item from the collection
what is wrong in my script?
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 ); }); });
};
erwin
source share