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

feathers-rest, how to query using $in? #497

Closed
davigmacode opened this issue Jan 16, 2017 · 3 comments
Closed

feathers-rest, how to query using $in? #497

davigmacode opened this issue Jan 16, 2017 · 3 comments

Comments

@davigmacode
Copy link

davigmacode commented Jan 16, 2017

Steps to reproduce

call api using feathers rest client

app.service('platforms').find({ query: { _id: { $in: [1, 3, 6] }, $sort: { fans: -1 } } })

Expected behavior

return platforms collection filtered by _id $in [1,3,6]

Actual behavior

return all platforms collection because the _id filter $in not generated to the query string

System configuration

NodeJS version:
6.9.1

Operating System:
Win 10

Browser Version:
Chrome

@davigmacode
Copy link
Author

it is actualy works when the array of _id is not empy

@daffl
Copy link
Member

daffl commented Jan 17, 2017

It looks like this is how Node's querystring module behaves (see nodejs/node-v0.x-archive#7971 for a discussion). Since it is using URL strings, there is always limitations (e.g. conversion and things like empty values etc.) imposed when using the REST clients (this is not an issue when using websockets).

Adding null (like { $in: [ null ] }) seems to make it work (but it might not be converted back into an empty array). The extended query parser qs seems to behave the same way so I don't think there is much we can do.

@daffl daffl closed this as completed Jan 17, 2017
daffl pushed a commit that referenced this issue Aug 29, 2018
* Updating changelog

* fixing the authentication config key that is referenced. Closes #497

* Work with 'authentication' or 'auth' config key

* Fix reference to app -> this.app
daffl pushed a commit that referenced this issue Aug 29, 2018
* Updating changelog

* fixing the authentication config key that is referenced. Closes #497

* Work with 'authentication' or 'auth' config key

* Fix reference to app -> this.app
@lock
Copy link

lock bot commented Feb 7, 2019

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants