Browse Source

Updating functionality of insert method

ogert 4 years ago
parent
commit
130606924a
1 changed files with 5 additions and 3 deletions
  1. 5 3
      cdplib/db_handlers/MongodbHandler.py

+ 5 - 3
cdplib/db_handlers/MongodbHandler.py

@@ -233,10 +233,12 @@ class MongodbHandler:
             if (len(data) == 1) or (isinstance(data, dict)):
 
                 if isinstance(data, pd.DataFrame) and (len(data) == 1):
-                    data = data.iloc[0]
+                    insert_data = data.iloc[0]
                 elif type(data) is list:
-                    data = data[0]
-                self._database[collection_name].insert_one(data)
+                    insert_data = data[0]
+                else:
+                    insert_data = data
+                self._database[collection_name].insert_one(insert_data)
             else:
                 self._database[collection_name].insert_many(data, ordered=ordered)