I'm trying to map an array of objects to a new array of objects. An example of the object in the array:
{
k:"Zip code"
v:{
questionId:"596080353"
question:"In which ZIP code do you currently reside?"
answer:"97213"
}
}
I want the final object to be:
{
"Zip code": "97213"
}
I'm having trouble setting k as the key name in the new object. Does anyone know how to use variables as the key name in a mongo aggregation?