Skip to content

Commit

Permalink
Pages updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tywalch committed Oct 20, 2024
1 parent 29b0c2f commit 660139c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions www/src/pages/en/core-concepts/v3-migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ ElectroDB v3 is the next major update after v2. You can also join the discussion

### Breaking changes

*Removes execution options `includeKeys` and `raw`*
**Removes execution options `includeKeys` and `raw`:**

The execution options `includeKeys` and `raw` were deprecated in version `2.0.0` and have now been removed in favor of the execution option `data`. To migrate from `v2`, use the options `{ data: "includeKeys" }` and `{ data: "raw" }` respectively.

*The `limit` execution option no longer plays a role in pagination*
**The `limit` execution option no longer plays a role in pagination:**

Providing the execution option `limit` on queries now _only_ applies a `Limit` parameter to its request to DynamoDB. Previously, the `limit` option would cause ElectroDB to effectively "seek" DynamoDB until the limit was _at least_ reached. The execution option `count` can be used in similar cases where `limit` was used, but performance may vary depending on your data and use case.

*Changes to `validate` callback on attributes*
**Changes to `validate` callback on attributes:**
The `validate` callback on attributes now expects a strict return type of `boolean`. Additionally, the semantic meaning of a boolean response has _flipped_. The callback should return `true` for "valid" values and `false` for "invalid" values. If your validation function throws an error, ElectroDB will still behave as it previously did in `v2`, by catching and wrapping the error.

*Significant changes to default behavior when performing `gt`, `lte`, and `between` queries*
**Significant changes to default behavior when performing `gt`, `lte`, and `between` queries:**

ElectroDB is changing how it generates query parameters to give more control to users. Prior to `v3`, query operations that used the `gt`, `lte`, or `between` methods would incur additional post-processing, including additional filter expressions and some sort key hacks. The post-processing was an attempt to bridge an interface gap between attribute-level considerations and key-level considerations. Checkout the GitHub issue championed by @rcoundon and @PaulJNewell77 [here](https://github.com/tywalch/electrodb/issues/228) to learn more.

With `v3`, ElectroDB will not apply post-processing to queries of any type and abstains from adding implicit/erroneous filter expressions to queries _by default_. This change should provide additional control to users to achieve more advanced queries, but also introduces some additional complexity. There are many factors related to sorting and using comparison queries that are not intuitive, and the simplest way to mitigate this is by using additional [filter expressions](https://electrodb.dev/en/queries/filters/) to ensure the items returned will match expectations.
Expand Down

0 comments on commit 660139c

Please sign in to comment.