Mongoose join 3 collections

Viewed 18

this is the code to join 2 collections in mongodb :

    Employee.aggregate([
      {
        $match: {
          nameAR: name,
        },
      },
      {
        $lookup: {
          from: "salaries",
          localField: "_id",
          foreignField: "employeeId",
          as: "report",
        },
      },
    ])

i want to join another collection vacation also on employeeId ( join 3 collections ), how to do that ?

0 Answers
Related