Skip to content
Advertisement

Check the index creation progress in mongo DB using java driver

I have around 10 millions of data in MongoDB. There is a requirement to add a new compound index. I used the following code to create the index. Using ensureIndex with option creation in background.

JavaScript

My question is how do I track the index creation progress. There are other sets of operations I need to do after confirming the Index is created 100%.

Please help me with how I do check the progress in java.

I am using mongo-java-driver 3.5 version.

Advertisement

Answer

You cann’t monitor them with mongo-java driver. But, you can monitor the created indexes in your Mongo shell:

JavaScript

This will return the output like:

JavaScript

For more about currentOp() refer here.

Hope this will help 🙂

Advertisement