Update: User.history watchedDates.length > 0
This commit is contained in:
parent
df3deb057c
commit
8f39312a6e
1 changed files with 3 additions and 1 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Reference in a new issue