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

[Docs] Update docs with checked type #553

Merged
merged 6 commits into from
Nov 26, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions client/www/pages/docs/instaql.md
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ console.log(data)
The `where` clause supports comparison operators on fields that are indexed and have checked types.

{% callout %}
Add indexes and checked types to your attributes from the [Explorer on the the Instant dashboard](/dash?t=explorer) or from the [cli with Schema-as-code](/docs/schema).
Add indexes and checked types to your attributes from the [Explorer on the Instant dashboard](/dash?t=explorer) or from the [cli with Schema-as-code](/docs/schema).
{% /callout %}

| Operator | Description | JS equivalent |
Expand Down Expand Up @@ -870,16 +870,19 @@ console.log(data)

### $like

The `where` clause supports `$like` queries that will return entities that match
a case-insensitive substring of the provided value for the field. You can use
`$like` to do queries like `contains`, `startsWith`, and `endsWith`.
The `where` clause supports `$like` on fields that are indexed with a checked `string` type.

`{ $like: "%promoted!" }` looks for values that end with "promoted!".
`$like` queries will return entities that match a case-insensitive substring of the provided value for the field. Here's how you can do queries like `startsWith`, `endsWith` and `includes`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're using like on the postgres side, which should be case sensitive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good callout! I meant to say case-sensitive but mixed them up


`{ $like: "Get%" }` looks for values that start with "Get".
| Example | Description | JS equivalent |
| :-----------------------: | :------------------: | :-----------: |
| `{ $like: "Get%" }` | Starts with 'Get' | `startsWith` |
| `{ $like: "%promoted!" }` | Ends with 'promoted' | `endsWith` |
| `{ $like: "%fit%" }` | Contains 'fit' | `includes` |

`{ $like: "%fit%" }` looks for values that contain "fit".

Here's how you can use `$like` to find all goals that end with the word
"promoted!"

```javascript
// Find all goals that end with the word "promoted!"
Expand Down