Quellcode durchsuchen

Added functionality for more advanced queries in query_data_and_generate_dataframe

ogert vor 4 Jahren
Ursprung
Commit
2f739bf62d
1 geänderte Dateien mit 7 neuen und 2 gelöschten Zeilen
  1. 7 2
      cdplib/db_handlers/MongodbHandler.py

+ 7 - 2
cdplib/db_handlers/MongodbHandler.py

@@ -275,7 +275,8 @@ class MongodbHandler:
 
     def query_data_and_generate_dataframe(self, collection_name: str, attribute: str = None,
                                           attribute_value: str = None, comparison_operator: str = '$eq',
-                                          index = None, return_as_dataframe: bool = True, return_id: bool = False, return_values: dict = None):
+                                          index = None, return_as_dataframe: bool = True, return_id: bool = False,
+                                          find_query:dict = None, return_values: dict = None):
         '''
 
         '''
@@ -284,7 +285,11 @@ class MongodbHandler:
 
         try:
             if attribute == None or attribute_value == None:
-                query = {}
+                if find_query is None:
+                    query = {}
+                else:
+                    query = find_query
+
                 data = self._database[collection_name].find(query,return_values)
                 
             else: