I have two collections, article and comments, the articleId in comments is a foreign key of _id in article.
db.collection('article').aggregate([
{
$lookup: {
from: "comments",
localField: "_id",
foreignField: "articleId",
as: "comments"
}
},
...
])
but it doesn't work, because _id in article is an ObjectID and articleId is a string.