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

QueryIterator throws exception when result includes empty document #87

Closed
ka2ush19e opened this issue Dec 16, 2020 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@ka2ush19e
Copy link

When query result includes empty document, query iteration fails.

To reproduce:

from fireo.fields import TextField
from fireo.models import Model

class Company(Model):
    name = TextField()

Company.collection.create(name="Abc_company")
Company.collection.create()
Company.collection.create()

assert len(list(Company.collection.fetch())) == 3

The following exception is thrown:

Traceback (most recent call last):
  File "app.py", line 12, in <module>
    assert len(list(Company.collection.fetch())) == 3
  File "/usr/local/lib/python3.8/site-packages/fireo//queries/query_iterator.py", line 41, in __next__
    m._update_doc = self.query._update_doc_key(m)
  File "/usr/local/lib/python3.8/site-packages/fireo//queries/filter_query.py", line 437, in _update_doc_key
    update_doc_key = model.key
AttributeError: 'NoneType' object has no attribute 'key'
@AxeemHaider AxeemHaider added the bug Something isn't working label Dec 24, 2020
@AxeemHaider
Copy link
Contributor

Empty document can not be saved now.

Update to version 1.3.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants