var collectionNames = db.getCollectionNames();
for(var i = 0, len = collectionNames.length; i < len ; i++){
var collectionName = collectionNames[i];
if(collectionName.indexOf('cache_') == 0){
db[collectionName].drop()
}
}
출처 : http://stackoverflow.com/questions/12844531/mongodb-removing-all-collections-whose-name-matches-a-string
db.getCollectionNames().forEach(function(collection) { indexes = db[collection].getIndexes(); print("Indexes for " + collection + ":"); printjson(indexes); }); |