renamed argument for clarity
This commit is contained in:
@@ -6,16 +6,16 @@ from pymongo.collection import Collection
|
|||||||
|
|
||||||
def count_documents(
|
def count_documents(
|
||||||
collection: Collection,
|
collection: Collection,
|
||||||
has_annotation: bool = False,
|
only_with_annotation: bool = False,
|
||||||
) -> int:
|
) -> int:
|
||||||
"""
|
"""
|
||||||
Get the total number of documents
|
Get the total number of documents
|
||||||
in database that matches the filters.
|
in database that matches the filters.
|
||||||
"""
|
"""
|
||||||
assert isinstance(collection, Collection)
|
assert isinstance(collection, Collection)
|
||||||
assert isinstance(has_annotation, bool)
|
assert isinstance(only_with_annotation, bool)
|
||||||
# build query
|
# build query
|
||||||
query = {}
|
query = {}
|
||||||
if has_annotation:
|
if only_with_annotation:
|
||||||
query['annotation'] = {'$ne': None}
|
query['annotation'] = {'$ne': None}
|
||||||
return collection.count_documents(filter=query)
|
return collection.count_documents(filter=query)
|
||||||
|
|||||||
Reference in New Issue
Block a user