fix(core): fixed model.remove method with exec()

This commit is contained in:
OldHawk
2017-12-20 18:12:34 +08:00
parent 9b10478a71
commit 8375237fdf
3 changed files with 7 additions and 7 deletions

View File

@@ -327,7 +327,7 @@ exports.announce = function (req, res) {
Peer.remove({
torrent: req.torrent._id,
_id: {$nin: req.torrent._peers}
});
}).exec();
}
done(null);
@@ -741,7 +741,7 @@ exports.announce = function (req, res) {
$pull: {_peers: p._id}
}).exec();
p.remove();
p.remove().exec();
mtDebug.debugGreen('---------------removePeer()----------------');
}

View File

@@ -154,7 +154,7 @@ exports.delete = function (req, res) {
//}).exec();
torrent._subtitles.pull(r._id);
r.remove();
r.remove().exec();
res.json(torrent);
scoreUpdate(req, torrent.user, scoreConfig.action.uploadSubtitleBeDeleted);

View File

@@ -799,7 +799,7 @@ exports.toggleHnRStatus = function (req, res) {
removeTorrentHnRWarning(torrent._id);
Complete.remove({
torrent: torrent._id
});
}).exec();
}
//add server message
@@ -1199,11 +1199,11 @@ exports.delete = function (req, res) {
//remove all peers of the torrent
Peer.remove({
torrent: torrent._id
});
}).exec();
//remove all subtitle of the torrent
Subtitle.remove({
torrent: torrent._id
});
}).exec();
//update maker torrent count
if (torrent.maker) {
torrent.maker.update({
@@ -1220,7 +1220,7 @@ exports.delete = function (req, res) {
removeTorrentHnRWarning(torrent._id);
Complete.remove({
torrent: torrent._id
});
}).exec();
torrent.remove(function (err) {
if (err) {