I am a novice in Mongo database: I have a document in a collection, let's say with 5 properties(A,B,C,D,E). And, I have documents in the collection that contains all or some of the above properties. I want to write a query that will append the property values from all of the documents.
Document 1 = {Id:123, data:{A:3, B:4, C:34, D:45, E:4}}
Document 2 = {Id:123, data:{A:5, E:33}}
Document 3 = {Id:123, data:{B:499, C:24, E:39}}
Document 4 = {Id:123, data:{A:63, B:34, C:534, D:845, E:84}}
Document 5 = {Id:123, data:{E:4}}
For the ID123, i want the query output to be Output document
{Id:123, A:[3,5,63], B:[4,499,34],C:[34,24,534],D:[45,845],E:[4,33,39,84,4]}