I have this not very smart formatted Date:
"@timestamp" : "\"2017-06-02T06:59:57.205Z\""
I want to turn it into a ISODate properly but no success because of the "
and \
I guess.
db.test.find().forEach(function(d) { d['@timestamp'] = ISODate((d['@timestamp']).replace(/\"|\\/g, "")); db.collection.save(d); })
db.test.find().forEach(function(d) { d['@timestamp'] = ISODate(JSON.parse(d['@timestamp'])); db.collection.save(d); })
db.test.find().forEach(function(d) { d['@timestamp'] = ISODate(d['@timestamp']); db.collection.save(d); })
What is the easiest approach?