I am trying to save a date with javascript in MongoDB in ISODate format. But it just saves the date field in my MongoDB document in string format.
Here is the object that I submit to MongoDB to save as a document in this collection.
var currentDate = new Date();
postData = {
deviceID: deviceID,
companyID: companyID,
userID: userID,
date: currentDate
};
Everything works fine, except that the date field is simply saved in String format. Could not find any question that could give a clear answer to this problem, if there is, please direct me to the right place!
source
share