Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

299
Views
error = new Error('data and hash arguments required') in node js (Help )

I am trying to compare the password of user and their password in the DB where it is saved (MongoDB). When that user logs in, their input password and DB password need to be compared. But when I run the code it's showing me an error of Error: data and hash arguments required.

var db=require('../config/connection')
var collection=require('../config/collections')
const bcrypt=require('bcrypt')


module.exports={
   doSignup:(userData)=>{
       return new Promise(async(resolve,reject)=>{
         userData.Password= await bcrypt.hash(userData.Password,10)
        
      db.get().collection('user').insertOne(userData).then((data)=>{
            resolve(data.insertedId)
        })
        
    })
   },
   doLogin:(userData)=>{
      return new Promise(async(resolve,reject)=>{
        let loginstatus=false
        let response={}
        let user=await db.get().collection(collection.USER_COLLECTION).findOne({Email:userData.Email})
        if(user){
            bcrypt.compare(userData.Password,user.Password).then((status)=>{
                if(result){
                    console.log("login success");
                }else{
                    console.log("login failed");
                }
            })
                 }else
                {
            console.log('login failed');
                }
    })
 }
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!