node.js - How to store a full date format in mongoDB? -


i'm trying save data in mongodb database, send full date format "wednesday march 25 2015" example, when make http call save data including date, date format being saved in mongodb utc datetime this: '2016-05-18t16:00:00z', how can store full date format in databse?

my code saving data including date is:

app.post('/postdiary', authenticate, (req, res) => {  var diary = new diary ({     headachelevel: req.body.headachelevel,     headacheside: req.body.headacheside,     nausea: req.body.nausea,     aura: req.body.aura,     photophobia: req.body.photophobia,     phonophobia: req.body.phonophobia,     date: new date(req.body.date),     location: req.body.location,     weather: req.body.weather,     _creator: req.user._id });     diary.save().then( (diary) => {        res.send(diary);    }, (err) => {        res.status(400).send(err);    }); }); 

and part of date in schema this:

 date: {     type: date,     default: new date() }, 

hope can me that, thank you.


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -