I have a document that contains an array of arrays in my MongoDB collection.
{
"platformId":"CMC_123",
"carInfo":[
["Toyota",20,"White"],
["Suzuki",19,"Gray"],
["Ford",22,"Red"]
]
}
And I am expecting the below output
carMilage :{
"Toyota":20,
"Suzuki":19,
"Ford":22
}
My aggregation below
[
{
$match:{
platformId : "CMC_123"
}
},
{
$project:{
carMilage : '$carInfo'
}
}
]
I am stuck with the $project field. How to achieve the above output using the $project field. Thank you.