Skip to content

Commit 0f6f165

Browse files
committed
Add docs for multiple filters same field (#91)
1 parent efb3583 commit 0f6f165

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

read.mdx

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,35 @@ collection NFT {
147147
```
148148

149149

150-
### Multiple filters
150+
### Multiple filters on different fields
151151

152-
In order to use multiple where or sorts, you must specify the corresponding index.
152+
In order to use multiple `where` or `sort` clauses, you must specify the corresponding indexes in your schema.
153153

154154
<Snippet file="indexes/multi-field-index.mdx" />
155155

156156

157157

158+
### Multiple filters on the same field (starts with)
159+
160+
Multiple `where` clauses on the same field can only be applied for greater than/less than combinations (e.g. `>` or `>=` and `<` or `<=`).
161+
162+
Using the `>=` and `<` operators, you can filter records that start with a given prefix.
163+
164+
```js
165+
import { Polybase } from "@polybase/client"
166+
167+
const db = new Polybase({ defaultNamespace: "your-namespace" });
168+
const collectionReference = db.collection("cities");
169+
170+
171+
// Starts with UK
172+
const startsWithUK = await collectionReference
173+
.where("country", ">=", "UK")
174+
.where("country", "<", "UK~")
175+
.get();
176+
```
177+
178+
158179
## Listen for updates on a collection
159180

160181
```js
@@ -188,6 +209,7 @@ const collectionReference = db
188209
);
189210
```
190211

212+
191213
## Pagination
192214

193215
You can paginate through your results using the cursor returned from the

0 commit comments

Comments
 (0)