Skip to content

Commit

Permalink
fix: speed up listDocuments pagination (#1344)
Browse files Browse the repository at this point in the history
  • Loading branch information
sk- authored Oct 26, 2020
1 parent 6139b5f commit 498301d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions dev/src/reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2429,9 +2429,10 @@ export class CollectionReference<T = firestore.DocumentData>
parent: parentPath.formattedName,
collectionId: this.id,
showMissing: true,
// Setting `pageSize` to the maximum allowed value lets the backend cap
// the page size (currently to 300).
pageSize: Math.pow(2, 32) - 1,
// Setting `pageSize` to an arbitrarily large value lets the backend cap
// the page size (currently to 300). Note that the backend rejects
// MAX_INT32 (b/146883794).
pageSize: Math.pow(2, 16) - 1,
mask: {fieldPaths: []},
};

Expand Down
2 changes: 1 addition & 1 deletion dev/test/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe('Collection interface', () => {
parent: `${DATABASE_ROOT}/documents/a/b`,
collectionId: 'c',
showMissing: true,
pageSize: 4294967295,
pageSize: 65535,
mask: {fieldPaths: []},
});

Expand Down

0 comments on commit 498301d

Please sign in to comment.