From fd9523e99aa0e31392771caf496720c4f7f09353 Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Fri, 29 Apr 2022 11:15:32 -0500 Subject: [PATCH] enhancement mongodb --- setup.py | 2 +- transport/mongo.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 288e3f7..f87db4d 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() args = { "name":"data-transport", - "version":"1.4.8", + "version":"1.4.10", "author":"The Phi Technology LLC","author_email":"info@the-phi.com", "license":"MIT", "packages":["transport"]} diff --git a/transport/mongo.py b/transport/mongo.py index 9f4ff11..1be36a9 100644 --- a/transport/mongo.py +++ b/transport/mongo.py @@ -137,7 +137,7 @@ class MongoWriter(Mongo,Writer): pass - def write(self,info): + def write(self,info,**_args): """ This function will write to a given collection i.e add a record to a collection (no updates) @param info new record in the collection to be added @@ -148,13 +148,13 @@ class MongoWriter(Mongo,Writer): # self.db[self.uid].insert_many(info) # else: try: - + _uid = self.uid if 'doc' not in _args else _args['doc'] if self._lock : Mongo.lock.acquire() if type(info) == list or type(info) == pd.DataFrame : - self.db[self.uid].insert_many(info if type(info) == list else info.to_dict(orient='records')) + self.db[_uid].insert_many(info if type(info) == list else info.to_dict(orient='records')) else: - self.db[self.uid].insert_one(info) + self.db[_uid].insert_one(info) finally: if self._lock : Mongo.lock.release()