import pandas as pd
import pymongo
# 7649
data_list = []
db_stroage = pymongo.MongoClient('mongodb://114.115.221.202:27017', username='admin', password='ZZsn@9988').ZZSN['7-17全球企业资讯删除数据']
# datas = db_stroage.find({"内容": {"$ne": None, "$exists": True}})
# 导出标签是空的数据
datas = db_stroage.find()
link = []
for data in datas:
    del data['_id']
    del data['id']

    if data['标题'] not in link:
        data_list.append(data)
        link.append(data['标题'])

    # print(data)
print(len(data_list))
df = pd.DataFrame(data_list)
df.to_excel('./7-17全球企业资讯不保留数据.xlsx',index=False)