i'm new to mongoBD. i have join two table using $lookup. i have two models Posts and Savedpost. I need to compare two field postId and savedBy i check mongoDb documentation for lookup and i try
Posts.aggregate([{
$lookup: {
from: Savedpost.collection.name, // collection name in db
localField: "_id", // Post id from Post collection
foreignField: "postId", // postId from Savedpost collection
as: "isSaved"
},
}]).exec(function(err, students) {
res.send(students)
});
here i compare with only postId but i need to compare both fields postId and savedBy it is possible and how ?
Thank you