My dataset looks like this:
{"id":1,"Timestamp":"Mon, 11 May 2015 07:57:46 GMT","brand":"a"}
{"id":2,"Timestamp":"Mon, 11 May 2015 08:57:46 GMT","brand":"a"}
I'm aiming for the following data format:
{"id":1,"Timestamp":ISODate("2015-05-11T07:57:46Z"),"brand":"a"}
{"id":2,"Timestamp":ISODate("2015-05-11T08:57:46Z"),"brand":"b"}
To achieve this, I currently use the following code:
db.tmpAll.find().forEach(
function (a) {
a.Timestamp = new Date(a.Timestamp);
db.tmpAll2.insert(a);
}
);
The code works fine but takes a few minutes to execute and requires creating a new collection. Is there a more efficient way to accomplish this task?