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

collection.find_one should return None if nothing is found #1

Open
alfredodeza opened this issue Oct 30, 2014 · 1 comment
Open

collection.find_one should return None if nothing is found #1

alfredodeza opened this issue Oct 30, 2014 · 1 comment

Comments

@alfredodeza
Copy link
Contributor

Because otherwise it will raise IndexError while attempting to get the first item on the list.

Which forces a consumer to dance around it by:

documents = collection.find(doc, limit=1)
if documents:
    document = documents[0]

Or the same with a try/except that catches IndexError.

@plutec
Copy link

plutec commented Aug 25, 2016

This issue doesn't exist in the current code. You fixed with issue #3 .

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

No branches or pull requests

2 participants