I'm using mongoDB and I have documents similar to the following
{
"files": ["Customers", "Items", "Contacts"],
"counts": [1354, 892, 1542],
...
}
And using an aggregation pipeline stage, I want to convert the above into something more like..
{
"file_info": [
{"file_name": "Customers", "record_counts": 1354},
{"file_name": "Items", "record_counts": 892},
{"file_name": "Contacts", "record_counts": 1542}
]
}
I've tried using $map, $reduce, and $arrayToObject but without any success. What operators can I use to get from where I currently am to where I need to be?