Converting a mongo stored date back into milliseconds since Unix epoch when loaded?

前端 未结 5 405
名媛妹妹
名媛妹妹 2020-12-15 21:09

I am using Mongoose & Node.js for my webserver.

As a part of one of my document schemas, I have a \'timestamp\' field. The line for it in the schema is:

5条回答
  •  天涯浪人
    2020-12-15 21:36

    var schema = new Schema({
      timestamp: {type:Number, default: new Date().getTime()}
    });
    

    Hope this will solve your issue.

提交回复
热议问题