Compare commits
1 Commits
988afab81c
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| c2817fe0b3 |
@@ -97,16 +97,9 @@ exports.mostListened = function (filter, callback) {
|
|||||||
}
|
}
|
||||||
}, { $match: { "album.visibility": { $in: filter } } });
|
}, { $match: { "album.visibility": { $in: filter } } });
|
||||||
} else {
|
} else {
|
||||||
dbo.collection("history")
|
aggregate.unshift({ $match: { type: 'track' } });
|
||||||
.find()
|
}
|
||||||
.project({ _id: true })
|
aggregate.push({ $sort: { counter: -1, _id: -1 } }, { $limit: 6 })
|
||||||
.sort({ _id: -1 })
|
|
||||||
.limit(1000)
|
|
||||||
.toArray((err, ids) => {
|
|
||||||
let arr = ids.map(h => h._id);
|
|
||||||
|
|
||||||
aggregate.unshift({ $match: { type: 'track', _id: { $in: arr } } });
|
|
||||||
aggregate.push({ $sort: { counter: -1 } }, { $limit: 6 })
|
|
||||||
|
|
||||||
dbo
|
dbo
|
||||||
.collection("history")
|
.collection("history")
|
||||||
@@ -117,7 +110,4 @@ exports.mostListened = function (filter, callback) {
|
|||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
callback(result);
|
callback(result);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user