Mongo Updates being super slow Mongo Updates being super slow heroku heroku

Mongo Updates being super slow


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/


if you are not using this then try this oneIndex builds can block write operations on your database, so you don’t want to build indexes in the foreground on large tables during peak usage. You can use the background creation of indexes by specifying background: true when creating.

db.collection.createIndex({ a:1 }, { background: true })

This will ultimately take longer to complete, but it will not block operations and will have less of an impact on performance.


1) Shard Lead collection by id as shard key. 2) Check if the memory taken by mongodb due to index is less than the memory of the mongoDb server.