# -*- coding: utf-8 -*-
# @Time : 2018/9/11 17:16
# @Author : cxa
# @File : mongotest.py
# @Software: PyCharm
import pymongo
client = pymongo.MongoClient(host='172.17.0.170')
db = client.库名
collection = db.表名
print(collection.find({'status':0}).count())#查找status字段值为0的 数据的条数
#collection.update_many({},{'$set':{'status':0,'last_crawl_time':0}}) #更新所有的状态
#c2.update_many({'status':3},{'$rename': {'type_url ': 'type_url'}}) #修改表名
# results = collection.find({'status': 1})