Hey everyone,
I have this schema
userId
username
displayName
createdAt
avatarUrl
stats {
followers [
{
followerId:
}
]
}
I’d like to make $lookup aggregation to get the entire user schema into follower object in “stats.followers”.
I tried something like this but it doesn’t work
{$lookup: {
from: "users",
localField: "stats.followers.userId",
foreignField: "userId",
as: "stats.followers.userData"
}}
I want to get follower data for every single follower object in “stats.followers”
Thank you for your help.