首页 > 代码库 > mongoDB index

mongoDB index

1. create index

db.students.ensureIndex({class:1,student_name:1})

 http://docs.mongodb.org/manual/tutorial/create-an-index/

2. show all indexes in current DB

db.system.indexes.find()

 3. show index for a collection

db.grades.getIndexes()

 4. delete index

db.grades.dropIndex({"student_id":1})

 

mongoDB index