Update: User.history watchedDates.length > 0

This commit is contained in:
Yûki VACHOT 2021-12-13 21:03:45 +01:00
parent df3deb057c
commit 8f39312a6e

View file

@ -445,7 +445,9 @@ exports.history = (req, res) => {
if(token){
const id = token.id;
Video.aggregate([{$match: {userId: id}}, {$limit: 300},
Video.aggregate([
{$match: {userId: id, $expr: {$gt: [{$size: "$watchedDates"}, 0]}}},
{$limit: 300},
{$project: {
videoId: true,
source: true,