-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
docs: remove fields filter warning #5856
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example in L52-53:
/customers?filter[fields][id]=false&filter[fields][name]=true&filter[fields][address]=true
Or omit the name
field:
/customers?filter[fields][name]=true&filter[fields][address]=true
docs/site/Fields-filter.md
Outdated
@@ -27,9 +27,6 @@ query will include **only** those you specifically include with filters. | |||
|
|||
### REST API | |||
|
|||
{% include warning.html content=" | |||
As a known bug, the option `<false>` does not work for url for now. Please include the properties you need or use the [stringified JSON format](Querying-data.html#using-stringified-json-in-rest-queries) to meet your requirement. The bug is tracked in the GH issue [#4992](https://github.com/strongloop/loopback-next/issues/4992)" %} | |||
|
|||
<pre> | |||
filter[fields][<i>propertyName</i>]=true&filter[fields][<i>propertyName</i>]=true... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
->
filter[fields][propertyName]=true|false&filter[fields][propertyName]=true|false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated 👍
dc99d97
to
cff264d
Compare
@agnes512 Thank you, I adjusted the content a bit, now it's: Return customer information only with await customerRepository.find({fields: {id: false, name: true, address: true}}); Or use stringified JSON format: Include all required properties: Or omit the hidden property: |
docs/site/Fields-filter.md
Outdated
@@ -50,14 +47,18 @@ Return customer information only with `name` and `address`, and hide their `id`: | |||
await customerRepository.find({fields: {id: false, name: true, address: true}}); | |||
``` | |||
|
|||
Or use stringified JSON format: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick:
Other filters have the stringified JSON format example after the REST examples.
docs/site/Fields-filter.md
Outdated
|
||
`/orders?filter={"fields":{"name":true,"address":true,"id":false}}` | ||
`/customers?filter[fields][id]=false` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw this might not be correct if the model has properties other than id
, name
, and address
.
cff264d
to
ea6e0f8
Compare
@agnes512 I just realized there are 2 separate examples for include and exclude, re-wrote the content, ptal thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Update docs after fixing #4992
Checklist
👉 Read and sign the CLA (Contributor License Agreement) 👈
npm test
passes on your machinepackages/cli
were updatedexamples/*
were updated👉 Check out how to submit a PR 👈