Answer the question
In order to leave comments, you need to log in
How to display an array of photos and their total number?
How to output this using .aggregate:
{
"count": 3,
"items": [{ }, { }, { }]
}
const findImages = Image.aggregate(
[
{"$count": "count"},
{"$sort": {[sort]: -1}},
{"$skip": parseInt(skip)},
{"$limit": parseInt(limit)},
{
"$project": {
"userId": 1,
"name": 1,
"tag": 1,
"count": 1
}
}
]);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question