-1
データベース内のユーザー入力と一致する電子メールアドレスを照会しようとしています。私はfindOne()
を使用していますが、どういうわけか、私はそれで問題が生じています:findOne()を使用して電子メールアドレスを照会する
Profile.findOne({emailaddress : req.body.emailaddress}, function(matchinguser) {
console.dir("matching user" + matchinguser);
Profile.create(req.params.all(), function (err, profile) {
console.dir(profile);
if (err) {
req.session.flash = {
err: err
}
return res.redirect('/profile/new')
}
res.redirect('/profile')
req.session.flash = {};
}) //profile created
}) //findone
'findOne()'コールバック関数に 'err'パラメータがなく、結果(' matchinguser' param)のみがあります。 – chridam
* "どういうわけか私はそれに問題を抱えています:" *拡張してください。 "Profile.findOne({emailaddress:req.body.emailaddress}、function(err、matchinguser){..' "問題" –