fixed bug when extracting names from list

This commit is contained in:
Brian Bjarke Jensen
2024-03-20 18:46:33 +01:00
parent 8965eb7192
commit 080c7e7a5c
+4 -1
View File
@@ -37,6 +37,7 @@ def list_names(
query = {} query = {}
if has_annotation: if has_annotation:
query['annotation'] = {'$ne': None} query['annotation'] = {'$ne': None}
# execute query
res_list = collection.find( res_list = collection.find(
filter=query, filter=query,
projection={ projection={
@@ -44,7 +45,9 @@ def list_names(
'name': True, 'name': True,
}, },
) )
return list(res_list) # extract information
name_list = [elem['name'] for elem in res_list]
return name_list
def total_documents( def total_documents(