i am facing a challenge, i have array of documents… i want to add new field which is going to be result of a $filter… and for this filter input is another array field of the current document of the array we are iterating…
Structure is like this:
products:[
{
"charges": [{}, {}, ....., {}]
},
{
"charges": [{}, {}, ....., {}]
},
.
.
.
{
"charges": [{}, {}, ....., {}]
}
]
Output expected:
products:[
{
"charges": [{}, {}, ....., {}],
"filteredCharges": [{}, {}, ....., {}]
},
{
"charges": [{}, {}, ....., {}],
"filteredCharges": [{}, {}, ....., {}]
},
.
.
.
{
"charges": [{}, {}, ....., {}],
"filteredCharges": [{}, {}, ....., {}]
}
]