I have two different arrays in array aggregators with multiple collections that I need to merge efficiently:
- Array 1: Contains
firstname,lastname, andemail(10 records). - Array 2: Contains
ageandemail(same 10 emails).
I need to combine them into one array with all fields (firstname, lastname, age, email) using email as the key.
For Example:
Array 1:
[{
“firstname”: “A”,
“lastname”: “AA”,
“email”: “A@gmail.com”
},
{
“firstname”: “B”,
“lastname”: “BB”,
“email”: “B@gmail.com”
},
{
“firstname”: “C”,
“lastname”: “CC”,
“email”: “C@gmail.com”
},
…
]
Array 2:
[{
“age”: “20”,
“email”: “A@gmail com”
},
{
“age”: “21”
“email”: “B@gmail com”
},
{
“age”: “22”
“email”: “C@gmail com”
},
…
]
Desired Output:
[{
“firstname”: “A”,
“lastname”: “AA”,
“age”: “20”,
“email”: “A@gmail com”
},
{
“firstname”: “B”,
“lastname”: “BB”,
“age”: “21”,
“email”: “B@gmail com”
},
{
“firstname”: “C”,
“lastname”: “CC”,
“age”: “22”,
“email”: “C@gmail com”
},
…
]
I tried to use iterator but it would cost me as many operations as many emails I have and I wanna know Is there a way to make this efficiently? maybe with built-in Make funcitons?
Thanks in advance!


