We can create the index by createIndex() in Mongo DB, to drop the index we can use dropIndex() command.

dropIndex() command will not drop the _id field.



db.studentDetails.dropIndex({Department:-1})

db.studentDetails.dropIndex({Name:1})

Should mention exact field and value that you have given while created to drop the index

The above deleted index is previously created so it have been dropped, check the createIndex() here.



db.studentDetails.dropIndex(“indexName”)

This will drop the index by passing index name.