欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

pymongo

程序员文章站 2022-05-28 20:25:21
...
from fangjia import mongoClients as mongoClients
import time
import pandas

def get_collection(db, name, host="192.168.0.136", port=27017):
    return mongoClients.MongoClients(db, name, host, port).collection

def findHouse(query, fields=None):

        seawater105 = get_collection("fangjia", "seawater", "192.168.0.105", 27777)    
        for err_count in range(0, 10):


            try:

                lt= seawater105.count(query)
                pos = list(seawater105.find(query).limit(lt))
                data=pandas.DataFrame(pos)
                del pos
                return data

            except:
                 #err_count = err_count + 1
                 time.sleep(1)
                 print('query error')



        raise Exception("yang ben cha xun shi bai")       
相关标签: pymongo