I have a data set that looks like the one below
[{
_id: ObjectID(),
data: {
key1: value,
key2: value
}
},
{
_id: ObjectId(),
data: {
key1: value,
key2: value
}
}]
I want to convert the same into
[
[_id,key1,key2], [_id,key1,key2]
]
I have tried the aggregation framework but couldn't come up with any way of doing this. I want to avoid looping over the objects if possible but don't know if it would be possible to do so.