In this recipe, we will be looking at some common operations we can perform on indexes like viewing, deleting, checking index sizes, and re-indexing.
Managing existing indexes
Getting ready
For this recipe, load the sample dataset and create an index on the city field, as described in the previous recipe.
How to do it...
- We begin by connecting to the mongo shell of the server and viewing all indexes on the system:
> db.mockdata.getIndexes()
The following result is obtained:
[
{
"v" : 2,
"key" : {
"_id" : 1
},
"name...