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){
|
if(token){
|
||||||
const id = token.id;
|
const id = token.id;
|
||||||
|
|
||||||
Video.aggregate([{$match: {userId: id}}, {$limit: 300},
|
Video.aggregate([
|
||||||
|
{$match: {userId: id, $expr: {$gt: [{$size: "$watchedDates"}, 0]}}},
|
||||||
|
{$limit: 300},
|
||||||
{$project: {
|
{$project: {
|
||||||
videoId: true,
|
videoId: true,
|
||||||
source: true,
|
source: true,
|
||||||
|
|
|
||||||
Reference in a new issue