mirror of
https://github.com/cnodejs/nodeclub.git
synced 2025-12-08 19:55:55 +00:00
16 lines
374 B
JavaScript
16 lines
374 B
JavaScript
/**
|
|
* 给所有的 Model 扩展功能
|
|
* http://mongoosejs.com/docs/plugins.html
|
|
*/
|
|
var tools = require('../common/tools');
|
|
|
|
module.exports = function (schema) {
|
|
schema.methods.create_at_ago = function () {
|
|
return tools.formatDate(this.create_at, true);
|
|
};
|
|
|
|
schema.methods.update_at_ago = function () {
|
|
return tools.formatDate(this.update_at, true);
|
|
};
|
|
};
|