mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-19 23:50:07 +02:00
feat(core): add mongoose to 5.0.17 support
This commit is contained in:
@@ -65,7 +65,7 @@ exports.list = function (req, res) {
|
||||
|
||||
var forumsTopicsCount = function (callback) {
|
||||
|
||||
Topic.aggregate({
|
||||
Topic.aggregate([{
|
||||
// $match: condition,
|
||||
$project: {
|
||||
'forum': '$forum',
|
||||
@@ -90,7 +90,7 @@ exports.list = function (req, res) {
|
||||
_id: '$forum',
|
||||
count: {$sum: 1}
|
||||
}
|
||||
}).exec(function (err, counts) {
|
||||
}]).exec(function (err, counts) {
|
||||
if (err) {
|
||||
callback(err, null);
|
||||
} else {
|
||||
@@ -100,7 +100,7 @@ exports.list = function (req, res) {
|
||||
};
|
||||
|
||||
var forumsRepliesCount = function (callback) {
|
||||
Topic.aggregate({
|
||||
Topic.aggregate([{
|
||||
$unwind: '$_replies'
|
||||
}, {
|
||||
$project: {
|
||||
@@ -126,7 +126,7 @@ exports.list = function (req, res) {
|
||||
_id: '$forum',
|
||||
count: {$sum: 1}
|
||||
}
|
||||
}).exec(function (err, counts) {
|
||||
}]).exec(function (err, counts) {
|
||||
if (err) {
|
||||
callback(err, null);
|
||||
} else {
|
||||
|
||||
@@ -1935,13 +1935,13 @@ exports.siteInfo = function (req, res) {
|
||||
};
|
||||
|
||||
var totalUpDown = function (callback) {
|
||||
User.aggregate({
|
||||
User.aggregate([{
|
||||
$group: {
|
||||
_id: null,
|
||||
uploaded: {$sum: '$uploaded'},
|
||||
downloaded: {$sum: '$downloaded'}
|
||||
}
|
||||
}).exec(function (err, total) {
|
||||
}]).exec(function (err, total) {
|
||||
if (err) {
|
||||
callback(err, null);
|
||||
} else {
|
||||
@@ -1951,14 +1951,14 @@ exports.siteInfo = function (req, res) {
|
||||
};
|
||||
|
||||
var totalTorrentsSize = function (callback) {
|
||||
Torrent.aggregate({
|
||||
Torrent.aggregate([{
|
||||
$group: {
|
||||
_id: null,
|
||||
size: {$sum: '$torrent_size'},
|
||||
seeders: {$sum: '$torrent_seeds'},
|
||||
leechers: {$sum: '$torrent_leechers'}
|
||||
}
|
||||
}).exec(function (err, total) {
|
||||
}]).exec(function (err, total) {
|
||||
if (err) {
|
||||
callback(err, null);
|
||||
} else {
|
||||
@@ -1978,12 +1978,12 @@ exports.siteInfo = function (req, res) {
|
||||
};
|
||||
|
||||
var totalForumReplies = function (callback) {
|
||||
Topic.aggregate({
|
||||
Topic.aggregate([{
|
||||
$group: {
|
||||
_id: null,
|
||||
replies: {$sum: '$replyCount'}
|
||||
}
|
||||
}).exec(function (err, total) {
|
||||
}]).exec(function (err, total) {
|
||||
if (err) {
|
||||
callback(err, null);
|
||||
} else {
|
||||
|
||||
@@ -199,7 +199,7 @@ function writeIsSaling(torrent) {
|
||||
TorrentSchema.methods.updateSeedLeechNumbers = function (callback) {
|
||||
var torrent = this;
|
||||
|
||||
Peer.aggregate({
|
||||
Peer.aggregate([{
|
||||
$match: {
|
||||
torrent: torrent._id,
|
||||
last_announce_at: {$gt: new Date(Date.now() - announceConfig.announceInterval - announceConfig.announceIdleTime)}
|
||||
@@ -209,7 +209,7 @@ TorrentSchema.methods.updateSeedLeechNumbers = function (callback) {
|
||||
_id: '$peer_status',
|
||||
count: {$sum: 1}
|
||||
}
|
||||
}).exec(function (err, counts) {
|
||||
}]).exec(function (err, counts) {
|
||||
if (!err) {
|
||||
var sc = 0;
|
||||
var lc = 0;
|
||||
|
||||
@@ -446,7 +446,7 @@ UserSchema.methods.globalUpdateMethod = function (cb) {
|
||||
UserSchema.methods.updateSeedLeechNumbers = function (callback) {
|
||||
var user = this;
|
||||
|
||||
Peer.aggregate({
|
||||
Peer.aggregate([{
|
||||
$match: {
|
||||
user: user._id,
|
||||
last_announce_at: {$gt: new Date(Date.now() - announceConfig.announceInterval - announceConfig.announceIdleTime)}
|
||||
@@ -456,7 +456,7 @@ UserSchema.methods.updateSeedLeechNumbers = function (callback) {
|
||||
_id: '$peer_status',
|
||||
count: {$sum: 1}
|
||||
}
|
||||
}).exec(function (err, counts) {
|
||||
}]).exec(function (err, counts) {
|
||||
if (!err) {
|
||||
var sc = 0;
|
||||
var lc = 0;
|
||||
|
||||
Reference in New Issue
Block a user