My Schema: {name,slug,parentId}
My expected output is :
{
id:61d0983e656c00e7cb0441c5,
name:"Programing",
parentId:null,
clildren:[
{
id:61d0990ba60d4408732bb595,
name:"Java",
parentId:61d0983e656c00e7cb0441c5,
subCate:[
{
id:61d099b1ed4ac943623cb28d,
name:"Project",
parentId:61d0990ba60d4408732bb595,
subCate:[]
}
]
}
]
}
how to get this type of result.