var _getUser = function () {
/* 用户定义 */
var userSchema = new Schema({
username: {type: String, required: true, unique: true},// 用户名
password: {type: String, required: true},
email: {type: String}, // 邮箱
website: {type: String}, // 个人网站
address: {type: String}, // 所在地点
github: {type: String}, // github
signature: {type: String}, // 个人签名
job: {type: String}, // 职业,
created_time: {type: Date, default: Date.now} // 创建时间
}, {
//单独写出来的时间戳.
timestamps: {
createdAt: 'created_at',
updatedAt: 'updated_at'
}
});
userSchema.methods.validPassword = function (password) {
return utils.md5(password, 'base64') == this.password;
};
var User = mongoose.model('User', userSchema);
return Promise.promisifyAll(User);
};
在dbHelper.js文件中.
在dbHelper.js文件中.