最赞回答 / 柏树4063064
UserSchema.pre('save',function(next){ var user = this; console.log('this is first'); //保存新数据 if(this.isNew){ this.meta.createAt = this.meta.updateAt =Date.now(); } else{ //更新数据 this.meta.updateAt = Date.now(); } bcrypt.genSalt(SALT_WORK_FACTOR,function...
2016-05-21
最赞回答 / Scarecrow_
bcrypt.compare(_password, user.password, function(err, isMatch) { if (err){ console.log(err); return cb(err) } //console.log(_password+user.password); //cb(null, isMatch) //上面代码出错,始终验证密码错误,自己修正如下 if(_password==user.passwo...
2016-05-13
最新回答 / 慕盖茨5004946
查看mongo就知道{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"user":{"_id":"5742d3d0bf426b441d5a9efc","name":"admin","key":"$2a$10$Ov5hVYc1fSNkaYh0huakkeh9.RjmwnTAlJ49hur74rBoN01RKWfNq","__v":0,"meta":{"loginedIp":"","loginedAt":"...
2016-05-01
最新回答 / kangkai_fe
得到的是个数组, 每个[object]都是{from: ObjectId("XXX"), to: ObjectId("XXX"), _id: XXX},但是不知道为啥会返回俩一样的对象......
2016-04-26
最新回答 / muyy
movie里有category,提交表单movie时需要知道this movie是属于哪一个category的;category里有movie,是首页需要,一个category里有多少movie,可以展现出来 movies{[1],[2],...}
2016-04-19