Error: the update operation document must contain atomic operators

I understand better your use-case.

You want to use update with aggregation because you want your new field be calculated from the existing field _id. That explains why you add square brackets at first.

For this to work, you need brackets (unlike what I mentioned). The real issue was that the closing bracket was at the wrong place. It has to be after the 3 closing curly braces rather than after the upsert: and multi: option object. To be clear, rather than

try

db.test.updateMany({}, [{$set:{ createdAt:{$toDate:"$_id"}}}],{upsert:false, multi:true })

Please read Formatting code and log snippets in posts before posting code or documents.