datacollect/taptap/collect_mongodb.py
2019-10-08 10:48:07 +08:00

72 lines
2.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
from ops.mmongo import MongodbBase
import pdb
# mongodb://10.10.5.4/taptap games
# {
# "_id": "5d91abaa7ed6a01e9824f941",
# "tags": ["魔性", "io", "休闲"],
# "source": "taptap",
# "cateName": "download",
# "icon": "https://img.tapimg.com/market/lcs/601735dfe48b2fbac327851d75b0dc72_360.png?imageMogr2/auto-orient/strip",
# "order": 1,
# "title": "我的大刀四十米(测试版)",
# "author": "厂商: 睡神飞工作室",
# "score": 8.3,
# "desc": "明明可以靠抄袭偏偏却要死磕原创。我不知道明明是谁反正我们是偏偏。全新玩法io类游戏来啦魔性欢快地砍来砍去吧开局一把刀越砍刀越长谁挡我砍谁我长我有理不服来砍我睡神飞工作室继《我飞刀玩得贼6》之后又一新品魔性翻倍快乐翻倍",
# "cate": "休闲",
# "gameid": 176279,
# "date": "2019-09-30",
# "watch": 65640,
# "reserve": 0,
# "sell": 0,
# "download": 0,
# "review": 199,
# "topic": 36,
# "__v": 0,
# "createdAt": "2019-09-30T07:15:54.041Z",
# "updatedAt": "2019-09-30T07:15:54.041Z"
# }
# event_3_3_8002 = {}
# event_3_3_8002['db'] = "beagle-production"
# event_3_3_8002['coll'] = "compay_record"
# event_3_3_8002['event_name'] = "event_3_3"
# event_3_3_8002['gameid'] = 8002
# event_3_3_8002['pipeline'] = [{'$match': {'createdAt': {'$gte': start_date, '$lt': end_date}}},
# {"$unwind": "$wechat_pay_result"}, {
# '$project': {'money_records': 1, 'pay_type': 1, 'account': 1, 'status': 1, 'money': 1, 'createdAt': 1,
# 'updatedAt': 1, 'return_code': '$wechat_pay_result.return_code',
# 'result_code': '$wechat_pay_result.result_code', 'return_msg': '$wechat_pay_result.return_msg',
# 'payment_no': '$wechat_pay_result.payment_no', 'payment_time': '$wechat_pay_result.payment_time',
# 'original_msg': '$wechat_pay_result.original_msg', 'payment_no': 1, 'payment_time': 1,
# 'distinct_id': '$_id', 'object_id': '$_id', '_id': 0}}]
#
class CollectMongo():
def __init__(self):
pass
def read_mongo(self):
args = dict()
args['host'] = '10.10.5.6'
args['port'] = 27017
args['dbname'] = 'taptap'
args['collname'] = 'games'
pdb.set_trace()
m = MongodbBase(**args)
r = m.query()
print(f"get from mongodb was {r}")
def main():
cc = CollectMongo()
cc.read_mongo()
if __name__ == "__main__":
main()