Hi,
I have a collection of portfolios like:
{"title":String,"isinList":[{"isinNo":String,"weight":Number}], ...}
For the isinNo, I have another collection as product_master. Now I want to do a lookup on product_master to fetch all information for the ISIN like:
[
{
'$lookup': {
'let': {
'isins': '$isinList.isinNo'
},
'from': 'product_master',
'as': 'instruments',
'pipeline': [
{
'$match': {
'body.ISIN': {
'$in': '$$isins'
}
}
}
]
}
}
]
However here, I am getting an error ‘$in needs an array’. If I do $addField as ‘$isinList.isinNo’, it adds up an array of ISINs.
I am not getting it clear as to where is it going wrong. Thanks in advance for the help.