octabytes / FireO

Google Cloud Firestore modern and simplest convenient ORM package in Python. FireO is specifically designed for the Google's Firestore
https://fireo.octabyte.io
Apache License 2.0
247 stars 29 forks source link

Fix limit with cursor #191

Closed ADR-007 closed 1 year ago

ADR-007 commented 1 year ago

Related issue

AxeemHaider commented 1 year ago

This issue was working fine for me. Don't know why you are facing this issue and I'm not able to understand what you change, can you please explain your changes.

Thanks

ADR-007 commented 1 year ago

All the tests fail without the changes. But please let me know if you think it is not the expected behavior.

The main problem was that in .fetch() it has limit=None by default. So, it deletes limit from cursor, but not from query:

self.cursor_dict['limit'] = limit
if limit:
    self.n_limit = limit

So, I could not use query like query.limit(5).fetch() because it sets "no limit" in the cursor. So, I have to use query.fetch(5) or query.limit(5).fetch(5)

Also, .limit(None) removed the limit from the cursor but not from this query in a similar way:

self.cursor_dict['limit'] = count
if count:
    self.n_limit = count

P.S: I don't use the cursor anymore, so this problem is not actual for me anymore :)