Explorar el Código

Added functionality for more advanced queries in query_data_and_generate_dataframe

ogert hace 4 años
padre
commit
2f739bf62d
Se han modificado 1 ficheros con 7 adiciones y 2 borrados
  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: