Skip to content

Commit

Permalink
Merge 40ef87b into 5f0a251
Browse files Browse the repository at this point in the history
  • Loading branch information
tywalch committed Dec 6, 2021
2 parents 5f0a251 + 40ef87b commit 74262fb
Show file tree
Hide file tree
Showing 13 changed files with 354 additions and 509 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,8 @@ All notable changes to this project will be documented in this file. Breaking ch
- As a byproduct of enhancing validation errors, the format of message text on a validation error has changed. This could be breaking if your app had a hardcoded dependency on the exact text of a thrown validation error.

### Fixed
- For Set attributes, the callback functions `get`, `set`, and `validate` are now consistently given an Array of values. These functions would sometimes (incorrectly) be called with a DynamoDB DocClient Set.
- For Set attributes, the callback functions `get`, `set`, and `validate` are now consistently given an Array of values. These functions would sometimes (incorrectly) be called with a DynamoDB DocClient Set.

## [1.6.1] - 2021-12-05
### Fixed
- In some cases the `find()` and `match()` methods would incorrectly select an index without a complete partition key. This would result in validation exceptions preventing the user from querying if an index definition and provided attribute object aligned improperly. This was fixed and a slightly more robust mechanism for ranking indexes was made.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3720,6 +3720,8 @@ DynamoDB offers three methods to query records: `get`, `query`, and `scan`. In *

> _NOTE: The Find method is similar to the Match method with one exception: The attributes you supply directly to the `.find()` method will only be used to identify and fulfill your index access patterns. Any values supplied that do not contribute to a composite key will not be applied as query filters. Furthermore, if the values you provide do not resolve to an index access pattern, then a table scan will be performed. Use the `where()` chain method to further filter beyond keys, or use [Match](#match-records) for the convenience of automatic filtering based on the values given directly to that method._
The Find method is useful when the index chosen does not matter or is not known. If your secondary indexes do not contain all attributes then this method might not be right for you. The mechanism that picks the best index for a given payload is subject to improvement and change without triggering a breaking change release version.

```javascript
await StoreLocations.find({
mallId: "EastPointe",
Expand Down Expand Up @@ -3750,8 +3752,11 @@ await StoreLocations.find({

Match is a convenience method based off of ElectroDB's [find](#find-records) method. Similar to Find, Match does not require you to provide keys, but under the covers it will leverage the attributes provided to choose the best index to query on.

> _NOTE: The Math method is useful when the index chosen does not matter or is not known. If your secondary indexes do not contain all attributes then this method might not be right for you. The mechanism that picks the best index for a given payload is subject to improvement and change without triggering a breaking change release version.
Match differs from [Find](#find-records) in that it will also include all supplied values into a query filter.


```javascript
await StoreLocations.find({
mallId: "EastPointe",
Expand Down
132 changes: 0 additions & 132 deletions examples/taskapp/package-lock.json

This file was deleted.

18 changes: 0 additions & 18 deletions examples/taskapp/package.json

This file was deleted.

133 changes: 0 additions & 133 deletions examples/taskapp_typescript/package-lock.json

This file was deleted.

20 changes: 0 additions & 20 deletions examples/taskapp_typescript/package.json

This file was deleted.

15 changes: 9 additions & 6 deletions examples/taskapp_typescript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ async function execute() {
* For more examples checkout the README.
**/
// Make table:
// await loader.makeTable();
await loader.makeTable();

// Load table:
// await loader.loadTable({employees: 500, tasks: 600});
await loader.loadTable({employees: 500, tasks: 600});

// Drop table:
// await loader.dropTable()
Expand All @@ -52,13 +52,14 @@ async function query() {
`);
process.exit(1);
}
const office = records[0]?.office;
// Use Collections to query across entities.
// Find office and staff information for the "Scranton Branch"
let scranton = await taskr.collections.workplaces({office: "Scranton Branch"}).go();
console.log("Workplace Collection:", scranton, "\r\n");
// Find office and staff information an office
let workplace = await taskr.collections.workplaces({office}).go();
console.log("Workplace Collection:", workplace, "\r\n");

// Get employee details and all assigned
let {firstName, lastName, employee} = scranton.employees[0];
let {firstName, lastName, employee} = workplace.employees[0];
let kanban = await taskr.collections.assignments({employee}).go();
console.log(`Assignments for ${firstName} ${lastName}:`, kanban, "\r\n");

Expand Down Expand Up @@ -102,3 +103,5 @@ async function query() {
//
}
}

execute().catch(console.error);

0 comments on commit 74262fb

Please sign in to comment.