def refresh(self): mongo=MongoClient() coll=mongo[self.dbname][self.collname] text=QString() for doc in coll.find(): text.append(str(doc)) text.append('\n') self.setText(text) mongo.close()
def set_db_and_coll(self,dbname,collname): self.dbname=str(dbname) self.collname=str(collname) print(self.dbname) print(self.collname) mongo=MongoClient() db = mongo[self.dbname] coll=db[self.collname] text=QString() for doc in coll.find(): text.append(str(doc)) text.append('\n') self.setText(text) mongo.close()