After Creating the index we need to check whether Index is created or not, this can be known by using getIndexes condition.
To get the list of indexes getIndexes() command is used, this will show all the created indexes for the mentioned collection.
To get the list of indexes getIndexes() command is used, this will show all the created indexes for the mentioned collection.
Syntax: db.collection.getIndexes()
db.studentDetails.getIndexes()
Output will throw all the indexes present in the studentDetails collection.