Skip to content

fix: .go({ data: 'raw', pages: 'all' }) now returns all pages#575

Open
thealpha93 wants to merge 1 commit into
tywalch:masterfrom
thealpha93:master
Open

fix: .go({ data: 'raw', pages: 'all' }) now returns all pages#575
thealpha93 wants to merge 1 commit into
tywalch:masterfrom
thealpha93:master

Conversation

@thealpha93

@thealpha93 thealpha93 commented May 21, 2026

Copy link
Copy Markdown

Fixes #574

Root cause

An early return response inside the executeQuery pagination loop exited after the first DynamoDB page whenever data: 'raw' was set. This made pages: 'all' and pages: N silently no-ops for raw queries — particularly dangerous with FilterExpressions, where matching records can be on later pages.

This behavior was originally intentional (raw = bypass ElectroDB processing), but the intent was to skip attribute transformation, not to disable pagination. The two concerns are orthogonal.

Fix

Instead of returning immediately, accumulate raw Items, Count, and ScannedCount across pages and return after the loop completes. The final LastEvaluatedKey and cursor reflect the last page fetched.

Tests

  • pages: 1 (default) — single page behavior preserved
  • pages: 'all' — items from all pages combined (the bug case)
  • pages: N — items from N pages combined
  • scan with pages: 'all' — same fix applies

Proof

image

- Introduced a new mechanism in the Entity class to aggregate results from multiple query responses when the data option is set to 'raw'.
- Added tests to validate the behavior of pagination across different scenarios, including single page, all pages, and a specified number of pages.
- Ensured that the last evaluated key and cursor are correctly handled in the aggregated response.
@netlify

netlify Bot commented May 21, 2026

Copy link
Copy Markdown

Deploy Preview for electrodb-dev ready!

Name Link
🔨 Latest commit dadb2d7
🔍 Latest deploy log https://app.netlify.com/projects/electrodb-dev/deploys/6a14cfb58772160008f80721
😎 Deploy Preview https://deploy-preview-575--electrodb-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread www/astro.config.mjs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.go({ data: 'raw', pages: 'all' }) only returns the first DynamoDB page

2 participants