码迷,mamicode.com
首页 > 数据库 > 详细

Python删除mongodb数据库和用户,查看Python操作mongodb的方法

时间:2018-10-05 15:02:26      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:try   查看   comm   for   and   python   opd   删除   cli   

#!/usr/bin/env python #coding:utf-8 from pymongo import MongoClient client = MongoClient(‘192.168.6.243‘, 27017) db=client[‘admin‘] db.authenticate(‘root‘,‘123456‘) #help(db) #查看python操作mongodb的方法 for i in range(2,900): try: db = client[‘s%s‘ % i] db.command("dropUser", "Tany") db.command("dropDatabase") except: print ‘not db‘

Python删除mongodb数据库和用户,查看Python操作mongodb的方法

标签:try   查看   comm   for   and   python   opd   删除   cli   

原文地址:http://blog.51cto.com/yht1990/2293952

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!