What happen to background index build if we lost connection to the db and lost connection to MongoShell?

Say we started a background index build, then we lost connection to the server and the database and we lost connection to MongoShell that was running the background index build
Would the index build continue to run in the background?

Sally Choo

Hi @Yook_20450,

One thing to note here:
If a background index build is in progress when a standalone mongod terminates, when the instance restarts the index build will restart as foreground index build. If the index build encounters any errors, the mongod will exit with an error.
To see the status of the index build, you can use db.currentOp() method in the mongo shell.

I would also recommend you to go through the following documentation link to see the changes in the index builds with MongoDB 4.2 version:

Please let me know, if you have any questions.

Thanks,
Sonali