Hi everyone Vikram here. This is my first question ever so super excited to learn and apologies if the syntax is not up to mark, I will improve with time.
- Item is an Array ( this doc has only one element)
- Adjudication is a nested Array with a variable number of elements(same structure)
- I want to create keys out of “adjudication.category.coding.code” without hardcoding as the values will be different with each document but will have the same string length
- I tried using $map to apply the same logic to each array element but failed
'item': [{'adjudication': [{'amount': {'code': 'USD',
'system': '4217',
'value': 22.51},
'category': {'coding': [{'code': 'bb.org/paid_amt',
'system': 'bb.org/adjudication'}]},
'reason': {'coding': [{'code': 'C',
'system': 'bb.org/drug_cvrg_stus_cd'}]}},
{'amount': {'code': 'USD',
'system': '4217',
'value': 0},
'category': {'coding': [{'code': 'bb.org/discount_amt',
'system': 'bb.org/adjudication'}]}}
]
}]
Output desired
adjudication: {paid_amt: 22.51, discount_amt: 0}