-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Custom API call does not filter all columns #1250
Comments
Hi @piere129 , thank you for this report. Can you check the request log you receive in your mongoDB ? |
the api call does a total of 3 requests, 2 of them being user-permission requests which don't seem to be the problem. The third one gives me the following JSON when logging the request:
|
I also just noticed that populating a list of categories, does not include the image details of those filled categories, but instead returns null, is this intentional..? And if so, how can this be worked around? |
@piere129 I have no time to test it. But the request you did with And if you don't use |
@lauriejim If i don't use the select it just returns all data as if you'd call a default api call. But that's not what I'm trying to achieve. I believe there is a feature in Strapi that adds these variables, after i do my mongoose query, a hook perhaps? |
Please try. It work on my side await Client
.findOne({
code: "eee"
}).select({name: 1}); |
Informations
What is the current behavior?
I'm calling a custom API route called
/client/categories/:code
,that should return the categories column based on the entered ":code" passed. In service:The API call works but for some reason, the payload returned still includes the fields "avatar_image", "products" and "id", on top of the categories field:
Steps to reproduce the problem
make custom routing for calling the service and set all columns except the 'categories' column to 0.
What is the expected behavior?
API result should not include "avatar_image", "products" and "id"
Suggested solutions
I'm guessing there is a faulty hook somewhere that causes this
The text was updated successfully, but these errors were encountered: