I have 2 simple documents which I am trying to join but for some reason this query does not return any results. The syntax is correct but unfortunately it is not returning any data. I am trying to get the query under DOES NOT WORK to return results for me.
DOES NOT WORK
select ARRAY v FOR v IN borrow.borrowers WHEN v.members is not null END AS borrowers
FROM bkt_cpblending_dev lending
JOIN bkt_cpblending_dev borrow
ON KEYS (lending.applicationId || ‘-BORROWERS’)
where lending.class = ‘com.citi.pb.lending.entity.LendingApplication’
AND borrow.class = ‘com.citi.pb.lending.entity.collateral.Borrowers’****
AND ANY v IN borrow.borrowers SATISFIES v.members is not null END
WORKS
select ARRAY v FOR v IN borrow.borrowers WHEN v.members is not null END AS borrowers
FROM bkt_cpblending_dev lending
JOIN bkt_cpblending_dev borrow
ON KEYS (‘LENDING-MSBF-12345-BORROWERS’)
where lending._class = ‘com.citi.pb.lending.entity.LendingApplication’
AND borrow._class = ‘com.citi.pb.lending.entity.collateral.Borrowers’
AND ANY v IN borrow.borrowers SATISFIES v.members is not null END
----------------------DATA SETUP---------------------------------------
upsert into bkt_cpblending_dev (KEY, VALUE) VALUES (‘LENDING-MSBF-12345-BORROWERS’,
{
“_class”: “com.citi.pb.lending.entity.collateral.Borrowers”,
“borrowers”: [
{
“address”: " ADR_LINE",
“city”: “ADR_CITY_NM”,
“doddFrankInd”: “Not Enrolled”,
“egTitle”: “FST_NM”,
“egType”: “Individual”,
“entlKey”: “12345”,
“entlNbr”: “0272”,
“isSelected”: true,
“isSelectedForAddress”: false,
“marginUtilInd”: “NA”,
“members”: [
{
“addresses”: [
{
“address”: “ADR_LINE”,
“adrKey”: “10400000068184”,
“city”: “ADR_CITY”,
“ctry”: “US”,
“isSelectedForAddress”: true,
“zipcode”: “12345”
}
]
}
]
}
]
}
)
upsert into bkt_cpblending_dev (KEY, VALUE) VALUES (‘LENDING-MSBF-12345’,
{
“_class”: “com.citi.pb.lending.entity.LendingApplication”,
“applicationAcceptedDt”: 1536714611573,
“applicationApprovedDt”: 1536715700014,
“applicationDate”: 1536714417819,
“controlPerson”: false,
“crossCollateralization”: false,
“eSignFlag”: true,
“isNonSTP”: false,
“lastModification”: 1536718036164,
“lastModifiedBy”: “auditor”,
“purposeId”: “1003”,
“screens”: {
“screensCovered”: {
“ACCOUNTS_SELECTION”: true,
“ALL”: false,
“BORROWEREG_SELECTION”: true,
“CONTACTDETAILS_SELECTTION”: true,
“DASHBOARD”: false,
“FINAL_SELECTION”: true,
“REVIEWSCREEN_SELECTION”: true
}
},
“solicitedTransaction”: false,
“status”: “DOCUMENTS_BEING_PREPARED”,
“structuredRequest”: false
}
)