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

In a query, sortBy cannot be used without where #405

Closed
edas opened this issue Mar 20, 2019 · 4 comments
Closed

In a query, sortBy cannot be used without where #405

edas opened this issue Mar 20, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@edas
Copy link
Contributor

edas commented Mar 20, 2019

In a queryConnect, I tried to use client.find(doctype).sortBy({title: 'desc'})

Expected result: The list of documents sorted by title in descending order

Alternative expected result: An exception stating that this syntax isn't supported

Actual result: No document, no exception

Workaround: Using client.find(doctype).where({}).sortBy({title: 'desc'})

Possibly, the sortBy clause is only usable if we have a where clause. This should propably considered as a bug. In any case, the query shouldn't be silently ignored

@ptbrowne ptbrowne added the bug Something isn't working label Sep 25, 2019
@ptbrowne
Copy link
Contributor

Would you be interested in trying to solve this bug ?

@ptbrowne
Copy link
Contributor

Ping @edas

@edas
Copy link
Contributor Author

edas commented Oct 14, 2019

J'avais contourné le problème sur le moment. Il ne me parait pas urgent à partir du moment où il est référencé et où le contournement est simple

@Crash--
Copy link
Contributor

Crash-- commented Aug 17, 2022

Just tried, with the new syntax: client.query(Q('io.cozy.files').sortBy([{'name':'asc'}]) and I got a couch error saying that the selector is missing. So there is no more silent here, just a database that needs a selector to perform a sort.

@Crash-- Crash-- closed this as completed Aug 17, 2022
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

3 participants