datacollect/ops/scripts.py
2019-08-12 17:28:37 +08:00

18 lines
556 B
Python

# -*- coding: utf-8 -*-
import pymongo
import pdb
def get_activity_ids():
# get data from mongodb
# mongodb://10.10.5.6:27017/garfield-production/system_dics
# {type: 'share_cfg', deleted: false}
myclient = pymongo.MongoClient("mongodb://10.10.5.6:27017/")
mydb = myclient["garfield-production"]
mycol = mydb["system_dics"]
myquery = {'type': 'share_cfg', 'deleted': False}
out_area = {'key': 1, 'value': 1, '_id': 0}
all = {}
for x in mycol.find(myquery, out_area):
all[x['key']]=x['value']
return all