mongodb aggegation- project key in root to inside an object
Hi I have the following requirement.Somebody plz help me.
I am doing a mongodb aggregate operation for which my final data looks like below
{
"data":{
},
"subdata":[{}]
}
For some reason I would like to get the final result as
{
"data":{
"subdata":[{}]
}
}
I tried several ways.It is not working as I expected.
PS:I am not using mongoose.