
Mongo
米Py
一个偏执的Pyhtoner! 专业的数据工程师,从事数据采集,清洗,存储,分析,挖掘,展示全流程开发工作。
展开
-
python中使用mongo中的_id(ObjectId)
在Python中导入ObjectIdfrom bson.objectid import ObjectIda = [ObjectId('5bd184790640307f2515c99e'), ObjectId('5bd184790640307f2515c99f')]# map(lambda x: x.toString(), a)str(a)原创 2018-10-29 09:49:35 · 4783 阅读 · 0 评论 -
Python获取mongo文档的size大小
使用bson模块得到mongo返回文档大小import bsonres = db['log'].find_one({"sid": test_id})print len(bson.BSON.encode(res)) # Bprint len(bson.BSON.encode(res))*1.0/1024/1024 # MBprint len(bson.BSON.encode(res))*1...原创 2018-10-29 09:56:24 · 2841 阅读 · 0 评论