허당 레몬도리
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);

}); 






profile

허당 레몬도리

@LemonDory

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!