What is the getdate() equivalent for MongoDB?
You can try this.
db.testDBA.updateOne(
   {},
   {
     $currentDate: {
        modifiedOn:true
     },
     $set: {
        &quot;item&quot;:&quot;anything&quot;
     }
   })

I inserted a new document and updated it. It worked.

If I run this code again, the document will be updated like this