It's a type of Planche
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

mongodb_compact.py 457B

123456
  1. from pymongo import MongoClient
  2. mongo = MongoClient("mongodb+srv://admin:PASSWORD@staging.mongodb.staging.oonum.io/admin?ssl=false&retryWrites=true&serverSelectionTimeoutMS=5000&connectTimeoutMS=10000&authMechanism=SCRAM-SHA-256&w=majority")
  3. # mongo["auth"].command({"compact": "Orgs", "force": True})
  4. mongo["database"].command({"compact": "collection", "force": True}) # Mongo 4.4 can compact without blocking, older versions block IO during compaction.