I have two collections and both of them have the same key names platform, channel and month. When I am using lookup, the let step is taking the variables from the first collection and not the collection b. Using the dot operator also does not work.
Another problem is that month and year operators are not working in let.
It is the other way around. In $let, you defined variable using expression on source documents. If you think about, b`s documents are not yet there so you can’t refer to them; they start to exist when the $match inside the pipeline is evaluated. So you simply have to replace