Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2714 list cases #2733

Merged
merged 5 commits into from
Jun 21, 2022
Merged

2714 list cases #2733

merged 5 commits into from
Jun 21, 2022

Conversation

iamleeg
Copy link
Contributor

@iamleeg iamleeg commented Jun 21, 2022

Implement pagination behaviour in case listing.

return [Case.from_json(dumps(c)) for c in cases]

def count_cases(self) -> int:
return self.get_case_collection().count_documents({})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might use https://pymongo.readthedocs.io/en/stable/api/pymongo/collection.html#pymongo.collection.Collection.estimated_document_count -- not an issue in small collections, but maybe a bottleneck later on

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good point. I will make that change when I add query filters because the estimated count can't be used then so I'll have to split between that and count_documents()

@iamleeg iamleeg merged commit 6ee7b73 into main Jun 21, 2022
@iamleeg iamleeg deleted the 2714_list_cases branch June 21, 2022 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants