MongoDB: Drop all indexes on all collections in one database
This file contains 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
db.getCollectionNames().forEach( function (d) { | |
db[d].dropIndexes(); | |
}); | |
db.tilezoom_source.chunks.ensureIndex( { files_id: 1, n: 1 }, { unique: true } ); | |
db.tilezoom_artefacts.chunks.ensureIndex( { files_id: 1, n: 1 }, { unique: true } ); | |
db.mosaic_artefact.chunks.ensureIndex( { files_id: 1, n: 1 }, { unique: true } ); | |
db.mosaic_artefact_index.chunks.ensureIndex( { files_id: 1, n: 1 }, { unique: true } ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Better and safer to use
getCollection
, as dot-notation doesn't work with collection names starting or ending with underscores: