xxxxxxxxxx
let product = await Product.aggregate([
{$match: {_id: new mongoose.Types.ObjectId(req.headers.id)}},
{
$lookup: {
from: 'productsubcategories',
localField: 'parent',
foreignField: '_id',
as: 'fullParent',
}
},
{
$set: {
fullParent: { $first: '$fullParent'}
}
}
]).exec();