I'm using MongoDB and have a collection with roughly 75 million records. I have added a compound index on two "fields" by using the following command:
db.my_collection.ensureIndex({"data.items.text":1, "created_at":1},{background:true}).
Two days later I'm trying to see the status of the index creation. Running db.currentOp()
returns {}
, however when I try to create another index I get this error message:
cannot add index with a background operation in progress.
Is there a way to check the status/progress of the index creation job?
One thing to add - I am using mongodb version 2.0.6. Thanks!
I like:
Output example:
Documentation suggests:
Active Indexing Operations example.
At the mongo shell, type below command to show the current progress:
Simple one to just check progress of a single index going on:
outputs:
Unfortunately, DR9885 answer didn't work for me, he has spaces in the code posted (syntax error) and even if the spaces are removed, it returns nothing.
This works as of Mongo Shell
v3.6.0
Didn't read Bajal answer until after I posted mine, but it's almost exactly the same except that it's slightly shorter code and also works.
The following should print out index progress:
outputs:
You could use currentOp with a true argument which returns a more verbose output, including idle connections and system operations.
... and then you could use db.killOp() to Kill the desired operation.