在复制集架构primary上使用时,如果不使用force参数,则会报错,如下:
若想要对着一个数据库的所有collection集合进行compact命令的话,可以参考使用repairDatabase命令哦>use testDB>db.runCommand({repairDatabase:1})注:这个命令一定要谨慎使用,能不用的情况下尽量不用,因为会花费很多时间和性能官网的一句话是这样说的:The repairDatabase command compacts all collections in the database. It is identical to running the compact command on each collection individually新闻热点
疑难解答