A problem of operating the data queried by mongooser R.

  node.js, question

This is the kind of data returned.
图片描述
This object does not seem to be a corresponding document in the database but a model, and the internal attribute of _doc of this object is. But I can get the value directly from above

console.log(x.date);
 // 1474732800000

But assigning a value to a document is not enough

Calendar.find({
 date: {$gte: firstDayOfMonth}
 })
 .limit(35)
 .sort({
 date: 1
 })
 .then(dates => {
 dates.map(x => {
 x.date = moment(x.date).format('YYYY-MM-DD HH:mm:ss');
 console.log(x);
 // { _id: 57c5a02c8890a02814771e0d, date: 1477670400000, __v: 0 }
 });
 res.json(dates);
 });

The x._doc.date assignment for the model must be valid. I would like to know why and how to correct the data in the original document.

Try, dates = dates.toObject (); Then assign a value