How do I merge two different collections of same database into a new collection having similar field values in MongoDB compass?

Looks like you didn’t set your foreignField value correctly. Didn’t you say that it’s stored in field elevatorInfo.Institution_Characteristics.Unitid - you have to put the entire string not just the last part of the field path into foreignField. Also, localField has a capitalization issue, it should be unitId, not Unitid.

You also don’t need any $match after unwind because the $lookup will only match documents where the two values are equal.

Asya