Converting string to date in mongodb

The Solution to Converting string to date in mongodb is


In my case I have succeed with the following solution for converting field ClockInTime from ClockTime collection from string to Date type:

db.ClockTime.find().forEach(function(doc) { 
    doc.ClockInTime=new Date(doc.ClockInTime);
    db.ClockTime.save(doc); 
    })

~ Answered on 2013-06-04 13:22:12


Most Viewed Questions: