Q:

Mongo Updates being super slow

We are facing a timeout issue with our mongo updates. Our collection currently contains around 300 thousand documents. When we try to update a record via the UI, the server times out and the UI is stuck in limbo.
Lead.updateOne({
      _id: body.CandidateID
    }, {
      $set: {
        ingestionStatus: 'SUBMITTED',
        program: body.program,
        participant: body.participant,
        promotion: body.promotion,
        addressMeta: body.addressMeta,
        CreatedByID: body.CreatedByID,
        entryPerson: body.entryPerson,
        lastEnteredOn: body.lastEnteredOn,
        zipcode: body.zipcode,
        state: body.state,
        readableAddress: body.readableAddress,
        promotionId: body.promotionId,
        programId: body.programId,
        phone1: body.phone1,
        personId: body.personId,
        lastName: body.lastName,
        hasSignature: body.hasSignature,
        firstName: body.firstName,
        city: body.city,
        email: body.email,
        addressVerified: body.addressVerified,
        address: body.address,
        accountId: body.accountId
      }

This is how we update a single record. We are using mlab and Heroku in our stack. Looking for advice on how to speed this up considerably.
Thank you.

A:

If your indexes are fine then you could try rebuilding indexes on this collection. 
collection indexes from the mango command line:
For example, rebuild the lead collection indexes from the mongo command line:
db.lead.reIndex();

Reference:
https://docs.mongodb.com/v3.2/tutorial/manage-indexes/
https://docs.mongodb.com/manual/reference/command/repairDatabase/

