Skip to content

Commit 4a463d9

Browse files
committed
updated readme
1 parent 435c2a9 commit 4a463d9

1 file changed

Lines changed: 56 additions & 1 deletion

File tree

README.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* [Creating a Database](#creating-a-database)
77
* [Inserting & Updating](#inserting--updating)
88
* [Select Queries](#select-queries)
9+
* [Deleting](#deleting)
910
* [NodeJS](#nodejs)
1011
* [Example Usage](#example-usage)
1112

@@ -165,7 +166,9 @@ If you were to `select` query *Bob Smith* the result would look something like t
165166
Select Queries
166167
--------------
167168

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:
169172

170173
<h3>PersonsTable</h3>
171174

@@ -235,6 +238,58 @@ The above line of code selects the following row:
235238
</table>
236239

237240

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+
238293

239294
NodeJS
240295
------

0 commit comments

Comments
 (0)