Mongodb index creation job status

I use MongoDB and have a collection with approximately 75 million records. I added a composite index to the two โ€œfieldsโ€ using the following command:

db.my_collection.ensureIndex({"data.items.text":1, "created_at":1},{background:true}). 

Two days later, I try to see the creation status of the index. Running db.currentOp() returns {} , however, when I try to create a different 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!

+6
source share
2 answers

You can use currentOp with true , which returns more verbose output, including idle connections and system operations.

 db.currentOp(true) 

... and then you can use db.killOp () to kill the desired operation.

+6
source

Next, print the progress of the index:

 db .currentOp({"command.createIndexes": { $exists : true } }) .inprog .forEach(function(op){ print(op.msg) }) 

outputs:

 Index Build (background) Index Build (background): 5311727/27231147 19% 
0
source

All Articles