https://stackoverflow.com/users/6635464/ngshravil-py var spot on.
Jeg oprettede en anden 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,
}
};
Føjede det derefter til min aggregeringspipeline:
var agg = [
match,
lookup,
project,
project2,
];
Virkede! -- tak https://stackoverflow.com/users/6635464/ngshravil-py