You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/documentation/guides/event-filter.mdx
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ Effectively, each array is an OR condition, and the entire event pattern is an A
45
45
46
46
So the above event filter will match because `status == "ACCEPTED"`, and it would also match if `status == "REJECTED"`.
47
47
48
-
###String Filters
48
+
## String Filters
49
49
50
50
String filters are used to match string values within the event payload. You can filter events based on exact string matches, case-insensitive matches, starts-with, ends-with, and more.
51
51
@@ -56,7 +56,7 @@ String filters are used to match string values within the event payload. You can
56
56
-`name: [{ $endsWith: "hn" }]`: Triggers the job if the name field ends with "hn".
57
57
-`name: [{ $ignoreCaseEquals: "john" }]` : Triggers the job if the name field is equal to "john" regardless of case.
58
58
59
-
####Examples of string filters used in a Trigger.
59
+
### Examples
60
60
61
61
```ts
62
62
client.defineJob({
@@ -98,7 +98,7 @@ client.defineJob({
98
98
});
99
99
```
100
100
101
-
###Boolean Filters
101
+
## Boolean Filters
102
102
103
103
Boolean filters are used to filter events based on boolean values within the event payload.
104
104
@@ -107,7 +107,7 @@ Boolean filters are used to filter events based on boolean values within the eve
107
107
-`paidPlan: [true]`: Triggers the job if the `PaidPlan` field in the event payload is `true`.
108
108
-`isAdmin: [false]`: Triggers the job if the `isAdmin` field in the event payload is `false`.
109
109
110
-
####Examples of boolean filters used in a Trigger.
110
+
### Examples
111
111
112
112
```ts
113
113
client.defineJob({
@@ -150,7 +150,7 @@ client.defineJob({
150
150
});
151
151
```
152
152
153
-
###Number Filters
153
+
## Number Filters
154
154
155
155
Number filters are used to filter events based on numeric values within the event payload. It can also be used to perform numeric comparisons on values within the event payload.
156
156
@@ -164,7 +164,7 @@ Number filters are used to filter events based on numeric values within the even
164
164
-`age: [{ $gt: 20 }, { $lt: 40 }]`: Triggers the job if the `age` field is greater than 20 and less than 40.
165
165
-`score: [{ $between: [90, 110] }]`: Triggers the job if the `score` field is between 90 and 110.
166
166
167
-
####Examples of number filters used in a Trigger.
167
+
### Examples
168
168
169
169
```ts
170
170
client.defineJob({
@@ -242,15 +242,15 @@ client.defineJob({
242
242
});
243
243
```
244
244
245
-
###Array Filters
245
+
## Array Filters
246
246
247
247
Array filters are used to filter events based on the content of arrays within the event payload.
248
248
249
249
**Examples:**
250
250
251
251
-`hobbies: [{ $includes: "reading" }]`: Triggers the job if the hobbies array includes the value "reading".
252
252
253
-
#### Example of content filters being used in a Trigger.
253
+
###Examples
254
254
255
255
```ts
256
256
client.defineJob({
@@ -273,7 +273,7 @@ client.defineJob({
273
273
});
274
274
```
275
275
276
-
###Existence Filters
276
+
## Existence Filters
277
277
278
278
Existence filters are used to filter events based on the presence or absence of certain keys within the event payload.
279
279
@@ -282,7 +282,7 @@ Existence filters are used to filter events based on the presence or absence of
282
282
-`name: [{ $exists: true }]` : Triggers the job if the `name` field exists in the event payload.
283
283
-`foo: [{ $exists: false }]` : Triggers the job if the foo field does not exist in the event payload.
284
284
285
-
####Examples of existence filters used in a Trigger.
285
+
### Examples
286
286
287
287
```ts
288
288
client.defineJob({
@@ -323,7 +323,7 @@ client.defineJob({
323
323
});
324
324
```
325
325
326
-
###Combining Filters
326
+
## Combining Filters
327
327
328
328
Filters can be combined to create more complex conditions for triggering jobs.
329
329
@@ -334,7 +334,7 @@ Filters can be combined to create more complex conditions for triggering jobs.
334
334
-`name: ["Alice", "Bob"]` : Triggers the job if the name is either "Alice" or "Bob".
335
335
-`name: ["Alice", "Bob"], age: [30]` : Triggers the job if the name is either "Alice" or "Bob" and the age is 30.
336
336
337
-
####Examples of combining filters used in a Trigger.
337
+
### Examples
338
338
339
339
```ts
340
340
client.defineJob({
@@ -380,7 +380,7 @@ client.defineJob({
380
380
});
381
381
```
382
382
383
-
### Stripe Trigger with Event Filter
383
+
##Using with Stripe triggers
384
384
385
385
Here is an example of a Stripe Trigger with an Event Filter:
386
386
@@ -404,7 +404,7 @@ The job is triggered by the `onCustomerSubscriptionCreated` event from Stripe. I
404
404
405
405
- Currency: Only subscriptions with the currency "USD" will trigger this job.
406
406
407
-
### Supabase trigger with Event Filter
407
+
##Using with Supabase triggers
408
408
409
409
Here is an example of a Supabase Trigger with an Event Filter:
0 commit comments