MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

$merge does not create _id field in array of objects

I’m trying to duplicate records in my collections with different _ids. one way is fetch all documents and use insertMany but $merge seems simple and easy way, the problem here is the main _id is created whereas the _id inside array of objects are not created. Is there any way to create ObjectId manually inside aggregate function.

sample Data

{
    "_id" : ObjectId("5c42d0f81790b3fa623693ce"),
    "name" : "Contact Documents",
    "list" : [ 
        {
            "name" : "Passport",
            "default" : true,
            "_id" : ObjectId("5c4075b3da81d43f388fad9b")
        }
    ]
}

the list id has to be created