I am migrating the db from mysql to mongo, so I need to create a view in mongo, for that purpose, I need to use the left outer joins, which is $lookup in mongo. But, I want to join something like
LEFT JOIN `contracts` `con` ON ((`c`.`company_id` = con`.`company_id`)))
LEFT JOIN `contracts` `con2` ON (((`c`.`company_id`=`con2`.`company_id`)
AND (`con`.`contract_id` < `con2`.`contract_id`))))
Is it possible to use $lookup
twice against the same collection? I saw some queries which uses $lookup
more than once in the aggregate function, but it uses against different collections.