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:
time.sleep(1)
print('query error')
raise Exception("yang ben cha xun shi bai")