https://stackoverflow.com/users/6635464/ngshravil-py var perfekt.
Jag skapade en annan projektion:
var project2 = {
$project: {
"_id": 1,
"userId": 1,
"accessToken":1,
"count":{$size:"$notifications"},
"notifications._id":1,
"notifications.summaryId": 1,
"notifications.dateCreated":1,
"notifications.dateProcessed":1,
}
};
Lade sedan till det i min aggregeringspipeline:
var agg = [
match,
lookup,
project,
project2,
];
Arbetade ! -- tack https://stackoverflow.com/users/6635464/ngshravil-py