for i in Mongo.coll['res'].find({"$and":[{'ip':{'$exists':True}},
{'ip_info':{'$exists':False}}]}).distinct('ip'):
print i
import re
import pymongo
from pymongo import MongoClient
client = MongoClient()
client=MongoClient('127.0.0.1',27017)
db = client.bashiniandai
whois_dict = db.whois.find({'URL':'http://www.jianshu.com/'})
for item in whois_dict:
for k in item:
if item[k]:
print k,item[k]
server = Mongo.coll['Result'].find()
for i in server:
url = str(i['URL'])
if url.find('xxxx') != -1:
Mongo.coll['Result'].update({'URL' : url},
{"$set" : {'creation_date' : '2000-05-17', 'country' : 'CN',
'Registrar Registration Expiration Date' : '2023-05-17',
'updated_date' : '2017-10-27', 'Tech Name' : '中国xx科技集团公司'}},
upsert = True)