We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have been using this feature for a project and have noticed that when I build the query
db.filter(data, {}, sort_by='seq')
It would return a QuerySet object in the same order as if i used the query
QuerySet
db.filter(data, {})
This is true even when i intentionally saved the records to the Document class in a non sequential order.
Document
I tested using this code:
from blitzdb import FileBackend, Document db = FileBackend('this.db') class data(Document): pass db.begin() a = data({'seq': 3}) b = data({'seq': 5}) c = data({'seq': 1}) d = data({'seq': 4}) e = data({'seq': 2}) db.save(a) db.save(b) db.save(c) db.save(d) db.save(e) db.commit() # Filter 1 db.filter(data, {})[0]['seq'] # v0.2.4 return: 3 # fix return: 3 # Filter 2 db.filter(data, {}).sort('seq')[0]['seq'] # v0.2.4 return: 1 # fix return: 1 # Filter 3 from blitzdb.queryset import QuerySet as BaseQS db.filter(data, {}).sort('seq', BaseQS.DESCENDING)[0]['seq'] # v0.2.4 return: 5 # fix return: 5 # Filter 4 db.filter(data, {}, sort_by='seq')[0]['seq'] # v0.2.4 return: 3 # fix return: 1
I have built a fix for this and will add the pull request. I have also added tests to test_sorting.py
test_sorting.py
The text was updated successfully, but these errors were encountered:
Fix in pull request #26
Sorry, something went wrong.
No branches or pull requests
I have been using this feature for a project and have noticed that when I build the query
It would return a
QuerySet
object in the same order as if i used the queryThis is true even when i intentionally saved the records to the
Document
class in a non sequential order.I tested using this code:
I have built a fix for this and will add the pull request. I have also added tests to
test_sorting.py
The text was updated successfully, but these errors were encountered: