How to delete lots of mongodb collections at once?

前端 未结 5 561
刺人心
刺人心 2020-12-09 04:06

There are a lot of mongodb collections in my database that I need to delete. They all have similar names, and it would be easy to delete them if only wildcard characters cou

5条回答
  •  不知归路
    2020-12-09 04:43

    No, there's not a way to drop several collections by a wildcard/regex. You have to drop them one by one. I recently performed a similar task and my script was able to drop ~20-30 collections per second. How many do you have?

提交回复
热议问题