$addFields not working MongoDB

const mongo = client.db("demo-cluster")
const col = mongo.collection("samples")
  col.aggregate([ 
    {  
      $addFields: 
      { "date": Date.now() } 
    }
  ])  

The above code is supposed to edit my collection called “samples” and then add the field “date” to them with the value in Unix time. However, nothing is changing in my database. What am I missing about this?

Your code is using aggregate, but the description you provide beneath sounds like something that isn’t an aggregation. How do you explain this discrepancy? Would updateMany be good enough to do what you describe?

thanks, I’ll try using updateMany instead.
What’s an aggregation?