Skip to content

Instantly share code, notes, and snippets.

@saintc0d3r
Created June 26, 2014 13:41
Show Gist options
  • Select an option

  • Save saintc0d3r/4f8701f7632b0a720eff to your computer and use it in GitHub Desktop.

Select an option

Save saintc0d3r/4f8701f7632b0a720eff to your computer and use it in GitHub Desktop.
View & Dropping indexes in mongodb
// 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