redis-om-python icon indicating copy to clipboard operation
redis-om-python copied to clipboard

Add example in the README / docs that uses `sort_by`

Open simonprickett opened this issue 1 year ago • 0 comments

It's possible to sort results in ASCending or DESCending order like this... ASCending:

result_set = Book.find(
    (Book.author == "Robert A. Heinlein") & (Book.year_published > 1958) & (Book.year_published < 1974)
).sort_by("year_published")

and DESCending:

result_set = Book.find(
    (Book.author == "Robert A. Heinlein") & (Book.year_published > 1958) & (Book.year_published < 1974)
).sort_by("-year_published")

but there's no documentation or example for this.

simonprickett avatar Aug 18 '22 20:08 simonprickett