I am trying to rearrange the data in a stage of my aggregation pipeline as the form it is in is not what I need it to be.
Currently it is like so
foos: [
0: {
'code': “ABC",
'article': DBRef(‘collection', ‘#ID1#')
},
1: {
'code': “DEF",
'article': DBRef(‘collection', '#ID2#')
}
]
`
Whereas I need it to be like this
`
foos: {
"ABC": "#ID1#",
"DEF": "#ID2#"
}
`
Any pointers gratefully received