Created
June 26, 2014 13:41
-
-
Save saintc0d3r/4f8701f7632b0a720eff to your computer and use it in GitHub Desktop.
View & Dropping indexes in mongodb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Let's say, there is a database in the mongodb server named as 'school'. Let's use this database. | |
| use school | |
| // Let's view a list of available indexes on the 'school' database. | |
| db.system.indexes.find() | |
| // Let the 'school' db has a collection named as 'students'. Then, we want to list indexes on a particular collection ('students') | |
| db.students.getIndexes() | |
| // Supposed, there is an index for one of 'students' columns, let's say '_id'. Then, we want to delete this index | |
| db.students.dropIndex({'_id':1}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment