摘要: #coding:utf-8 __author__ = 'hdfs' import pymongo from pymongo import MongoClient client = MongoClient() client=MongoClient('10.0.0.9',27017) #连接mongodb数据库 client = MongoClient('mongodb://10.0.0.9:27... 阅读全文
posted @ 2016-06-22 23:27 similarface 阅读(18327) 评论(0) 推荐(0) 编辑
摘要: #聚合查询 from pymongo import MongoClient db = MongoClient('mongodb://10.0.0.9:27017/').aggregation_example #准备数据 result = db.things.insert_many([{"x": 1, "tags": ["dog", "cat"]}, ... 阅读全文
posted @ 2016-06-22 23:27 similarface 阅读(5194) 评论(0) 推荐(0) 编辑