From 4a463d93ddf36e01f14895a409ee1a141a557101 Mon Sep 17 00:00:00 2001 From: Liam <34695601+YeloPartyHat@users.noreply.github.com> Date: Fri, 1 Jul 2022 10:52:27 +1000 Subject: [PATCH] updated readme --- README.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0d17903..029bbdb 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ * [Creating a Database](#creating-a-database) * [Inserting & Updating](#inserting--updating) * [Select Queries](#select-queries) +* [Deleting](#deleting) * [NodeJS](#nodejs) * [Example Usage](#example-usage) @@ -165,7 +166,9 @@ If you were to `select` query *Bob Smith* the result would look something like t Select Queries -------------- -To select someone from the *People* table that has the firstName John, age 69, and their last name is not Gilmore: +You perform selects by passing an object matching what you're looking for. + +*For example:* to select someone from the *People* table that has the firstName John, age 69, and their last name is not Gilmore:

PersonsTable

@@ -235,6 +238,58 @@ The above line of code selects the following row: +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: + +```js +// Select all the people aged 20 to 60 +await LocalDatabase.select("PersonsTable", {age: {$lt: 60, $gte: 20}}); +``` + +Below are all the query selectors you can use in `select`: + +

Query Selectors

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SelectorDescription
$neNot equal to (≠)
$ltLess than (<)
$gtGreater than (>)
$lteLess than or equal to (≤)
$gteGreater than or equal to (≥)
+ + +Deleting +-------- + +To delete entries, simply pass the table and a query just like you would in a `select` to the `delete` method. + +```js +// Delete persons under the age of 18 +await LocalDatabase.delete("PersonsTable", {age: {$lt: 18}}); +``` + NodeJS ------