Prova questo:
db.A.aggregate([
{
$lookup: {
from: "B",
let: { refToA: "$_id" },
pipeline: [
{
$match: {
$expr: { $eq: ["$refToA", "$$refToA"] }
}
},
{
$lookup: {
from: "C",
localField: "refToCArray",
foreignField: "_id",
as: "refToCArray"
}
}
],
as: "BCollection"
}
}
]);