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

602
Views
ParallelSaveError: Can't save() the same doc multiple times in parallel

I moved my local db to mLab's free tier and I'm getting an error I didn't get before. ParallelSaveError: Can't save() the same doc multiple times in parallel

The error is catching from line user.save(). Could you take a look and please show how to fix it? I'm so lost...

// Confirm password.
// Execs after requiresAuth permission resolver.
const confirmPassword = ({ user, inputs: { password } }) => {
  // Validate args.
  validate([required, isLength], 'PASSWORD', password)

  // Required for graphql. Expects a promise.
  return new Promise((resolve, reject) =>
    user.comparePassword(password, (err, isMatch) => {
      if (err) return reject(err)
      if (!isMatch) return reject(error('CONFIRM_PASSWORD_FAILED'))
      return resolve(user)
    })
  )
}

// Compare submitted plain text password with the salted and hashed version.
    UserSchema.methods.comparePassword = function(candidatePassword, callback) {
      return bcrypt.compare(candidatePassword, this.password, (err, isMatch) => {
        if (isMatch) {
          this.account.authStrikes = 0
          this.account.lastConfirm = Date.now()
        } else {
          this.account.authStrikes += 1
          if (this.account.authStrikes === 3) {
            this.account.status = 'locked'
            require('../resolvers/auth')
              .createUnlockAccountToken({ userId: this._id })
          }
        }
        return this.save()
          .then(() => callback(null, isMatch))
          .catch(err => callback(err))
      })
    }
over 4 years ago · Santiago Trujillo
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!