Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: Adds an OR example.

Paul Copplestone52b2b348732a
diff --git a/web/docs/common/CommonFilters.js b/web/docs/common/CommonFilters.js
index d570cdd3586..b9946b2e3bb 100644
--- a/web/docs/common/CommonFilters.js
+++ b/web/docs/common/CommonFilters.js
@@ -21,12 +21,14 @@ import Sr from './filters/sr.mdx'
import Nxl from './filters/nxl.mdx'
import Nxr from './filters/nxr.mdx'
import Adj from './filters/adj.mdx'
+import Or from './filters/or.mdx'
const filters = {
filter: <Filter />,
not: <Not />,
match: <Match />,
+ or: <Or />,
eq: <Eq />,
neq: <Neq />,
gt: <Gt />,
diff --git a/web/docs/common/filters/or.mdx b/web/docs/common/filters/or.mdx
new file mode 100644
index 00000000000..f1863bb4d35
--- /dev/null
+++ b/web/docs/common/filters/or.mdx
@@ -0,0 +1,16 @@
+import Collapsable from '../../../src/components/Collapsable'
+
+#### General form
+<!-- prettier-ignore -->
+```js {3}
+supabase
+ .from(tableName)
+ .or(criteria)
+```
+
+To write append an `OR` filter, which should be made up of several other filters.
+
+#### `criteria: { string }`
+Filters to apply.
+
+---
\ No newline at end of file
diff --git a/web/docs/library/examples/get.js b/web/docs/library/examples/get.js
index 5f71166c753..609e31c4d7f 100644
--- a/web/docs/library/examples/get.js
+++ b/web/docs/library/examples/get.js
@@ -181,6 +181,18 @@ const getCities = async () => {
${errorJs}
`.trim()
+export const getOrJs = `
+${importJs}
+const getCities = async () => {
+ try {
+ let cities = await supabase
+ .from('cities')
+ .or('id.gt.20,and(name.eq.New Zealand,name.eq.France)')
+ .select('name, country_id')
+ return cities
+ ${errorJs}
+`.trim()
+
export const getMatchJs = `
${importJs}
const getCities = async () => {
diff --git a/web/docs/library/get.mdx b/web/docs/library/get.mdx
index 94bbbffa61e..4921a71880d 100644
--- a/web/docs/library/get.mdx
+++ b/web/docs/library/get.mdx
@@ -25,6 +25,7 @@ import {
getSingleJs,
getFilterJs,
getNotJs,
+ getOrJs,
getMatchJs,
getEqJs,
getNeqJs,
@@ -539,6 +540,18 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.
<CommonFilters filter="not" />
+### `or()`
+
+<CustomCodeBlock
+ header="Shows how to use or( ) with select( )"
+ js={getOrJs}
+ jsHighlight="{9}"
+/>
+
+<br />
+
+<CommonFilters filter="or" />
+
### `match()`
<CustomCodeBlock