Possibly raw CastError: is reset to date with an error for value "function now () {[native code]} on Mongoose

When starting the Express application, the following error appears:

Perhaps the raw CastError function: Cast to date failed for value "now () {[native code]}

The date field is defined on the model as:

updated: {
  type: Date,
  default: Date.now
}

So, I am logging the response, and the field comes with this format

updated: Thu May 21 2015 16:21:32 GMT-0300 (ART)

We are actually using Mongoose v 3.4.0

I also tried to format the response using Moment.js, but the warning still appears on the terminal.

I would appreciate your help.

+4
source share

Source: https://habr.com/ru/post/1589283/


All Articles