I have Dates in one collection that were inserted incorrectly and are in plain format "2015-09-10".
I would like to update them to fix the ISO date format .
I tried iterating through Mongo with forEach(), but I do not know the shell well enough about how to update each document in the collection.
While I am here:
db.getCollection('schedules').find({}).forEach(function (doc) {
doc.time = new Date( doc.time ).toUTCString();
printjson( doc.time );
});
What is missing here?
source
share