I have one document from sample_collection1 as
{ "_id": { "$oid": "5e597a2be08a070bab329ef3" }, "field1": "field1", "field2": [{ "field3": "1234123", "field4": [{ "field5": "3432", "field6": ["5e5ac0008def101ffa037100" ] }] }] }
and other document from sample_collection2 in one of the following type as
{"_id":{"$oid":"5e5ac0008def101ffa037100”},”childfield1”:”5e5ac0008def101ffa037906","childfield2”:”childfield2”,"childfield3”:”childfield3”}
or as
{"_id":{"$oid":"5e5ac0008def101ffa037906”},”childfield1”:” 5e5ac0008def101ffa037100","childfield2”:”childfield2”,"childfield3”:”childfield3”}
how to get following response dynamically if there n number of such fields to refer from other collections using spring mongo repository
{ "_id": { "$oid": "5e597a2be08a070bab329ef3" }, "field1": "field1", "field2": [{ "field3": "1234123", "field4": [{ "field5": "3432", "field6": [{”childfield1”:” ","childfield2”:”childfield2”,"childfield3”:”childfield3”} ] }] }] }