network 发表于 2016-12-2 10:09:31

python 连接mongo数据库,进行简单的增删该查

实例:
# -*- coding: cp936 -*-
import pymongo

dictSearContion = {'STATE_1':1, 'STATUS':1}

client = pymongo.MongoClient("192.168.0.103", 27017)
replyDB = client.REPLY
topicDB = client.TOPIC

def getExcelTopics(collectionName):
    topics = topicDB.TOPIC_COL.find(dictSearContion)
    for i in topics:
      print i



if __name__=='__main__':
    getExcelTopics("TOPIC_COLL")
页: [1]
查看完整版本: python 连接mongo数据库,进行简单的增删该查