fix: .go({ data: 'raw', pages: 'all' }) now returns all pages#575
Open
thealpha93 wants to merge 1 commit into
Open
fix: .go({ data: 'raw', pages: 'all' }) now returns all pages#575thealpha93 wants to merge 1 commit into
thealpha93 wants to merge 1 commit into
Conversation
- 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.
✅ Deploy Preview for electrodb-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #574
Root cause
An early
return responseinside theexecuteQuerypagination loop exited after the first DynamoDB page wheneverdata: 'raw'was set. This madepages: 'all'andpages: Nsilently 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, andScannedCountacross pages and return after the loop completes. The finalLastEvaluatedKeyandcursorreflect the last page fetched.Tests
pages: 1(default) — single page behavior preservedpages: 'all'— items from all pages combined (the bug case)pages: N— items from N pages combinedscanwithpages: 'all'— same fix appliesProof