当前位置:Gxlcms > 数据库问题 > Python MongoDB 删除集合

Python MongoDB 删除集合

时间:2021-07-01 10:21:17 帮助过:4人阅读

实例

删除 "customers" 集合:

import pymongo

myclient = pymongo.MongoClient("mongodb://localhost:27017/")
mydb = myclient["mydatabase"]
mycol = mydb["customers"]

mycol.drop()

运行实例

如果成功删除集合,则 drop() 方法返回 true,如果集合不存在则返回 false。

 

 

 

 

 

 

以上就是   Python MongoDB 删除集合   的详细内容,更多请关注w3school其它相关文章!

重庆代孕【徽信13022337922】、成都代孕【徽信13022337922】、长沙代孕【徽信13022337922】、

武汉代孕【徽信13022337922】、贵阳代孕【徽信13022337922】、昆明代孕【徽信13022337922】

Python MongoDB 删除集合

标签:详细   ref   xmx   customer   tail   nan   database   返回   tom   

人气教程排行