I want to get all levels of keys from a Mongo collection using aggregation. Let's say I have a collection with the below docs:
[
{
"t1":4,
"t2":"test",
"t3":{
"t4":"test1",
"t5":{
"t6":"test2"
}
}
},
{
"t1":5,
"t100":"test3",
"t3":"test4",
"t4":{
"t5":100
}
}
]
Required result: ["t1","t2", "t100", "t3", "t3.t4", "t3.t5", "t3.t5.t6", "t4", "t4.t5"]
Can anyone help me with this? Tried the below but it is not giving me all the nested keys in the documents. https://www.objectrocket.com/blog/how-to/get-keys-mongodb-collection/