In the previous recipes, whenever we've created indexes, it has always been in the foreground that is, the database server blocks all changes to the database until the index creation is completed. This is definitely not suitable for larger datasets where index creation time can take a few seconds which could be application errors.
Creating background indexes
Getting ready
Load the sample dataset, as shown in the Creating an index recipe.
How to do it...
- Remove all indexes:
> db.mockdata.dropIndexes()
{
"nIndexesWas" : 2,
"msg" : "...