|
@@ -281,17 +281,18 @@ class MongodbHandler:
|
|
|
|
|
|
try:
|
|
|
if attribute == None or attribute_value == None:
|
|
|
- data = self._database[collection_name].find({},return_values)
|
|
|
+ query = {}
|
|
|
else:
|
|
|
- data = self._database[collection_name].find({attribute: {comparison_operator: attribute_value}}, return_values)
|
|
|
+ query = {attribute: {comparison_operator: attribute_value}}
|
|
|
+
|
|
|
+ data = self._database[collection_name].find(query, return_values)
|
|
|
|
|
|
except Exception as error:
|
|
|
self._log.log_and_raise_error(('An error occured trying to query data from {}, with query {}: {}:{}. \nError:{}').format(collection_name, attribute, comparison_operator, attribute_value, error))
|
|
|
return None
|
|
|
|
|
|
- #print(data[0])
|
|
|
- #print(len(data[0]))
|
|
|
- if True: #data.retrieved() != 0:
|
|
|
+
|
|
|
+ if data.collection.count_documents(query) != 0:
|
|
|
if return_as_dataframe:
|
|
|
return self.convert_mongo_data_into_dataframe(data, index, collection_name)
|
|
|
else:
|