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.
Sachin Kalsi
Passionate Programmer
Try Project like this.
{ "$project": {"data": {"subdata": "$subdata","data": "$data"} } }