I have a collection of the following structure
{
_id : ObjectId("52f0795a58c5061aa34d436a"),
"attribute1" : [1, 3, 6, 7],
"attribute2" : [2, 4, 6, 8]
}
Is there any way I can merge the two attributes while removing duplicates using aggregation query in mongoDB? I need the result to be like this:
{
_id : ObjectId("52f0795a58c5061aa34d436a"),
"attribute3" : [1, 3, 6, 7, 2, 4, 8]
}