how to use when receiving data in body in localfield and foreignfield.
how to use _id after $match condition in localfield
const fetchData = await WorkflowModel.aggregate([
{
$match: {
_id: mongoose.Types.ObjectId(req.body.workflow_id),
},
},
{
$unwind: "$_id",
},
{
$lookup: {
from: "tasks",
localField: "_id",
foreignField:"workflow_id",
as: "task"
}
},
]);