Skip to content

Mail.find(keys: "ALL", order: :desc, count: 20, what: :first) doesn't return the most 20 recent messages.  #1610

Open
@wflanagan

Description

@wflanagan

When I do this query:

Mail.Find(keys: "ALL", order: :desc, count: 20, what: :first)

it's logical to me that it would return the 20 most recent items. But, it doesn't. It returns the 20 oldest.

To get the 20 most recent, and to thus implement some sort of hacky pagination, I have to do:

Mail.find(keys: "ALL", order: :asc, count: 20, what: :last) 

and then reverse the results to get the most recent items.

I'm not sure if i'm doing something wrong, but i spent a couple hours on this and didn't find a good solution.

Please close if this is "as designed." But, to me, it seems the order is applied AFTER the what is applied. The what is actually the ordering, and the order is what's done after the selection based on the count and what.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions