Answer the question
In order to leave comments, you need to log in
Why doesn't it update the collection document field?
I have a users collection created with mongoose. I'm trying to update the password field of this collection in the document:
exports.ChangePassword = function (user,userPasswords) {
User
.findOne({name:user})
.then(function (doc) {
if (hash(userPasswords.old = doc.password)){
User.update({name:doc.name},{$set:{password:userPasswords.new}})
}
})
};
function hash(text) {
return crypto.createHash('sha1')
.update(text).digest('base64')
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question