So, my problem is, that in MongoDB that .aggregate() function is not working
Heres some pictures:
You can see what a tried on the first picture
CodePudding user response:
When using "$lookup"
, it's important that both "localField"
values and "foreignField"
values have the same type.
In this case, "localField"
is a string and "foreignField"
is an ObjectId.
It's probably best for queries to use ObjectId's for both.