when I want to display the time when I want to leave a comment, my schema is written like this. After using moment.js, it shows the time when I wrote the comment for the first time after restarting node, and the time for writing the comment is the same as the first time. After restarting the server, the time for writing the comment is right again, and the second time is the same as the first one. No, no, no. , that new Date can"t even go to parentheses
var huatiSchema = new Schema({
username:{
type:String,
required:true
},
photo:{
type:String,
default:""
},
speak:{
type:String,
required:true
},
topic:{
type:String,
//required:true
default:""
},
created_time:{
type:String,
default:moment(new Date()).format("YYYY-MM-DD HH:mm:ss")
},
},
{
versionKey: false
})