-
Notifications
You must be signed in to change notification settings - Fork 96
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
$select doesn't work in find? #71
Comments
@beeplin how are you passing it in your code? We have tests that cover this that are passing. If needs to be under |
I just cloned
other stuffs work perfectly including $sort, &skit and #limit, but $select seems to be ignored. |
Hmm. ok we'll have to look into it. Unfortunately, it won't happen today. |
take ur time. :) if this got solved I d like to transform my old project from mongodb to mongoose and enjoy feathers~~ |
I'm not sure if others have noticed this, and it has to do with query parsing in your client, but I found that depending on how your request handler parses the query, and creates the subsequent url, you might have issues that are hard to debug without digging deeper. @beeplin can you please try the following and see if you get what you are looking for:
you're probably going to have to do the same to the $sort variable, or pass it in via a string like:
|
I think the docs are wrong. The service tests use an array. Can you try messageService.find({
query: {
$select: ['_id', 'text' ],
$sort: { createdAt: -1 },
$limit: this.props.limit || 10
}
}).then(page => this.setState({ messages: page.data.reverse() })); |
If that is the case, removing fields can probably be done best using the remove hook instead. |
This was indeed a mistake in the documentation, sorry about that. It is fixed now and works as I described above. |
so this array syntax only works for mongoose or for all other db adapters too? |
@beeplin This is part of our shared tests for all adapters: https://github.com/feathersjs/feathers-service-tests/blob/master/src/common-tests.js#L166 So all of them should support it. |
got it. Thanks~ 来自 魅族 MX5 -------- 原始邮件 --------
|
$select doesn't work in find operation. I found that the source code for $select is not the same as that in other packages like
feathers-mongodb
orfeathers-nedb
. Normally the code would be like this:but in
feathers-mongoose
(via github) it is like:and furthermore, in the actually
feathers-mongoose
npm package (v3.3.6) the source code is:The text was updated successfully, but these errors were encountered: