Join two collection Customer and CurrencyPair based on
currencyPair._id.branchNumber=customer._id.branchNumber and
currencyPair._id.productName=cu.product.productName
and currencyPair._id.ccyPairCatCode=customer.product.currency
Please help me
Customer Table
{
"_id" : {
"branchNumber" : "20540",
"baseNumber" : 2.0
},
"baseNumber" : NumberLong(2),
"branchNumber" : "20540",
"divertToManual" : "1",
"isSelected" : false,
"priceChannel" : "3",
"products" : [
{
"volimit" : "6",
"currency" : "3",
"override" : "Y",
"productName" : "FX",
"spread" : "4"
}
]
}
{
"_id" : {
"branchNumber" : "20010",
"baseNumber" : 600104.0
},
"baseNumber" : NumberLong(600104),
"branchNumber" : "20010",
"divertToManual" : "40",
"isSelected" : false,
"priceChannel" : "3987",
"product" : [
{
"productName" : "FX",
"currency" : "228",
"spread" : "118"
},
{
"productName" : "FX",
"currency" : "228",
"spread" : "119"
},
{
"productName" : "FX",
"currency" : "228",
"spread" : "110"
}
]
}
{
"_id" : {
"branchNumber" : "20540",
"baseNumber" : 20010.0
},
"baseNumber" : 20010.0,
"branchNumber" : "20540",
"divertToManual" : "11111",
"isSelected" : true,
"priceChannel" : "3333",
"product" : [
{
"productName" : "FX",
"currency" : "228",
"spread" : "118"
},
{
"productName" : "GX",
"currency" : "228",
"spread" : "119"
},
{
"productName" : "FX",
"currency" : "228",
"spread" : "110"
}
]
}
{
"_id" : {
"branchNumber" : "20540",
"baseNumber" : 30302002.0
},
"baseNumber" : 30302002.0,
"branchNumber" : "20540",
"divertToManual" : "44444",
"isSelected" : true,
"priceChannel" : "000000",
"product" : [
{
"productName" : "GX",
"currency" : "228",
"spread" : "118"
},
{
"productName" : "GX",
"currency" : "228",
"spread" : "119"
},
{
"productName" : "FX",
"currency" : "228",
"spread" : "110"
}
]
}
CurrencyPair
{
"_id" : {
"branchNumber" : "20010",
"ccyPairCatCode" : "240",
"productName" : "FX"
},
"branchNumber" : "20010",
"buyOrSell" : "2",
"productName" : "FX",
"ccyPairCatCode" : "240",
"ccyPairCatCodeGroup" : "cat-gpaks1123",
"ccyPairGroups" : [
{
"ccyPairs" : [
"USDCNH34",
"EURGBP76",
"EURJPY87",
"USDKZT"
],
"groupName" : "UNGROUPED"
}
]
}
{
"_id" : {
"branchNumber" : "20010",
"ccyPairCatCode" : "228",
"productName" : "FX"
},
"branchNumber" : "20010",
"buyOrSell" : "2",
"productName" : "FX",
"ccyPairCatCode" : "228",
"ccyPairCatCodeGroup" : "cat-gpaks",
"ccyPairGroups" : [
{
"ccyPairs" : [
"USDCNH",
"EURGBP",
"EURJPY",
"USDKZT"
],
"groupName" : "UNGROUPED"
}
]
}
{
"_id" : {
"branchNumber" : "20010",
"ccyPairCatCode" : "228",
"productName" : "GX"
},
"branchNumber" : "20010",
"buyOrSell" : "2",
"productName" : "GX",
"ccyPairCatCode" : "228",
"ccyPairCatCodeGroup" : "cat-gpaks11",
"ccyPairGroups" : [
{
"ccyPairs" : [
"USDCNH",
"EURGBP",
"EURJPY",
"USDKZT"
],
"groupName" : "UNGROUPED"
}
]
}
{
"_id" : {
"branchNumber" : "205",
"ccyPairCatCode" : "241",
"productName" : "FX"
},
"branchNumber" : "205",
"buyOrSell" : "987",
"productName" : "HJ",
"ccyPairCatCode" : "241",
"ccyPairCatCodeGroup" : "cat-gpaks11",
"ccyPairGroups" : [
{
"ccyPairs" : [
"USDCNH",
"EURGBP",
"EURJPY",
"USDKZT"
],
"groupName" : "UNGROUPED"
}
]
}