Thursday, February 6, 2014

How to remove all the Indexes from a MongoDB Collection (table)?

To remove all the Indexes from a collection (table) MongoDB has provided following syntax:

db.collection_name.dropIndex()

To remove one particular index from a collection (table) MongoDB has provided following syntax:

db.collection_name.dropIndex({field_name:Sorting_order(1 or -1))

For example to drop index “scores” from scores collection (table) we can issue following command:

db.scores.dropIndex({“score”:1})




 


 

What is MongoDB?
How to get Started with MongoDB
How to create or drop Database in MongoDB?
How to create Collection (Table) in MongoDB?
... More

Popular Posts

Blog Archive

Real Time Web Analytics