|
6 | 6 | * [Creating a Database](#creating-a-database) |
7 | 7 | * [Inserting & Updating](#inserting--updating) |
8 | 8 | * [Select Queries](#select-queries) |
| 9 | +* [Deleting](#deleting) |
9 | 10 | * [NodeJS](#nodejs) |
10 | 11 | * [Example Usage](#example-usage) |
11 | 12 |
|
@@ -165,7 +166,9 @@ If you were to `select` query *Bob Smith* the result would look something like t |
165 | 166 | Select Queries |
166 | 167 | -------------- |
167 | 168 |
|
168 | | -To select someone from the *People* table that has the firstName John, age 69, and their last name is not Gilmore: |
| 169 | +You perform selects by passing an object matching what you're looking for. |
| 170 | + |
| 171 | +*For example:* to select someone from the *People* table that has the firstName John, age 69, and their last name is not Gilmore: |
169 | 172 |
|
170 | 173 | <h3>PersonsTable</h3> |
171 | 174 |
|
@@ -235,6 +238,58 @@ The above line of code selects the following row: |
235 | 238 | </table> |
236 | 239 |
|
237 | 240 |
|
| 241 | +Notice the `$ne` at the end of the query? Instead of searching for exact values you can search within a range or not equal to something. You can use multiple of these in the same query in the same value as well: |
| 242 | + |
| 243 | +```js |
| 244 | +// Select all the people aged 20 to 60 |
| 245 | +await LocalDatabase.select("PersonsTable", {age: {$lt: 60, $gte: 20}}); |
| 246 | +``` |
| 247 | + |
| 248 | +Below are all the query selectors you can use in `select`: |
| 249 | + |
| 250 | +<h3>Query Selectors</h3> |
| 251 | +<table> |
| 252 | + <thead> |
| 253 | + <tr> |
| 254 | + <th>Selector</th> |
| 255 | + <th>Description</th> |
| 256 | + </tr> |
| 257 | + </thead> |
| 258 | + <tbody> |
| 259 | + <tr> |
| 260 | + <td>$ne</td> |
| 261 | + <td>Not equal to (≠)</td> |
| 262 | + </tr> |
| 263 | + <tr> |
| 264 | + <td>$lt</td> |
| 265 | + <td>Less than (<)</td> |
| 266 | + </tr> |
| 267 | + <tr> |
| 268 | + <td>$gt</td> |
| 269 | + <td>Greater than (>)</td> |
| 270 | + </tr> |
| 271 | + <tr> |
| 272 | + <td>$lte</td> |
| 273 | + <td>Less than or equal to (≤)</td> |
| 274 | + </tr> |
| 275 | + <tr> |
| 276 | + <td>$gte</td> |
| 277 | + <td>Greater than or equal to (≥)</td> |
| 278 | + </tr> |
| 279 | + </tbody> |
| 280 | +</table> |
| 281 | + |
| 282 | + |
| 283 | +Deleting |
| 284 | +-------- |
| 285 | + |
| 286 | +To delete entries, simply pass the table and a query just like you would in a `select` to the `delete` method. |
| 287 | + |
| 288 | +```js |
| 289 | +// Delete persons under the age of 18 |
| 290 | +await LocalDatabase.delete("PersonsTable", {age: {$lt: 18}}); |
| 291 | +``` |
| 292 | + |
238 | 293 |
|
239 | 294 | NodeJS |
240 | 295 | ------ |
|
0 commit comments