bug fix with mongodb

This commit is contained in:
Steve Nyemba 2019-11-05 16:05:06 -06:00
parent ac64f8de95
commit 008ae6edf9
1 changed files with 4 additions and 2 deletions

View File

@ -65,8 +65,10 @@ class MongoWriter(Mongo,Writer):
def write(self,**args): def write(self,**args):
# document = self.db[self.uid].find() # document = self.db[self.uid].find()
collection = self.db[self.uid] collection = self.db[self.uid]
collection.update_one() if type(args['row']) == list :
self.db[self.uid].insert_one(args['row']) self.db[self.uid].insert_many(args['row'])
else:
self.db[self.uid].insert_one(args['row'])
def set(self,document): def set(self,document):
collection = self.db[self.uid] collection = self.db[self.uid]
if collection.count_document() > 0 : if collection.count_document() > 0 :