I have a mongoDB database and have restructured how I store my date/times. However I would like to update any old documents that are not stored in this format.
Using NodeJS how could I use the previous value of a field and update it using its previous value.
I’m looking for something along the lines of:
function modifyDateFormat(oldDate){...}
let filter = {}
let update = {
$set: {date_time: modifyDateFormat(previousValue)}
}
db.collection("collection").updateMany(filter, update)