As far as I know, to combine collections using an operator $lookupin MongoDB, the data type must be the same. If the type mismatch then $lookupwill not work. Thus, to join, you must use those fields that are of the same type, because it checks for equality .
$lookup ""
localField type object, foreignField object
localField type string, foreignField string
localField type number, foreignField number
$lookup