Flatten Multiple dynamic parameters from mongodb nested json data

Hello Guys,

I have a scenario where I need to create a query for a nested structure data which have data in dynamic keys. Able to extract data for one dynamic parameter by directly flattening on the particular key but need to extract all available . Is there a way to extract dynamic mongoDB json parameters.

Example of json I want to flatten and get data

{
{“x”:[{“Value”:0}]},
{“y”:[{“Value”:1}]}
}