Answers for "mongodb drop indexes command"

3

mongodb drop index

# First Get Your Index name by
db.coll.getIndexes() # Because the index name would be different than the field name

# then Do
db.coll.dropIndex("column_1")
Posted by: Guest on July-14-2021
0

drop all indexes mongodb

db.getCollectionNames().forEach(function(collName) { 
    db.runCommand({dropIndexes: collName, index: "*"});
});
Posted by: Guest on December-20-2020

Code answers related to "BASIC"

Browse Popular Code Answers by Language