操作集合

给集合collection改名

mongo shell或代码(比如PythonPymongo)语法:

db.yourCollection.renameCollection("newCollectionName")

举例:

db.gameShortLink_20210816.renameCollection("gameShortLink_20210816_mockFailed")

注:MongoDB Compass中不支持collection改名

删除集合collection

mongo shell中去删除一个集合,用:

db.collection.drop()

举例:

db.gameShortLink_20210816.drop()

db.collection.drop() — MongoDB Manual

results matching ""

    No results matching ""