2

In SQL it looks like:

SELECT *
FROM cats_dat_ref
LEFT OUTER JOIN cats_dat_parts 
    ON cats_dat_ref.cat_folder = cats_dat_parts.cat_folder 
    AND cats_dat_ref.ref = cats_dat_parts.ref

I have:

db.cdr.aggregate([
    {
        $lookup: {
            from: "cdp",
            localField: "cat_folder",
            foreignField: "cat_folder",
            as: "cdp"
        }
    }, {
        $project: {
            ....
        }
    }
]).forEach(function (item) {
    ...
});

How do I add the second condition in lookup for ref = ref ?

chridam
  • 95,056
  • 21
  • 214
  • 219

0 Answers0