O'Reilly logo
  • Patrick S thinks this is interesting:

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

Now every time a new user is created its createdOn value will be set to the current date and time.

From

Cover of Mongoose for Application Development

Note

setting a default value (in schema)