Skip to content

BUGFIX: Firestore query should have orderBy to ensure correct pagination#132

Closed
canbal wants to merge 1 commit into
typesense:masterfrom
canbal:cbal/backfill_fix
Closed

BUGFIX: Firestore query should have orderBy to ensure correct pagination#132
canbal wants to merge 1 commit into
typesense:masterfrom
canbal:cbal/backfill_fix

Conversation

@canbal

@canbal canbal commented Jan 21, 2026

Copy link
Copy Markdown

Summary

Current backfill script does not scan all documents and may miss some documents. This is not well documented by Firebase SDK documentation, but as it can be seen from all examples, an orderBy is required to ensure all documents are reliably scanned through when pagination (i.e. startAfter or startAt) is used. Without it, the behavior is not deterministic.

This PR adds a orderBy(documentId(), "asc") to the backfill query as all collections have this native field and is not collection dependent.

Test plan

I deployed the modified extension and confirmed that it's running.

@tharropoulos

Copy link
Copy Markdown
Collaborator

@canbal the tests are failing. If you bandwidth doesn't allow it I can debug myself.

@canbal

canbal commented Mar 18, 2026 via email

Copy link
Copy Markdown
Author

@tharropoulos

Copy link
Copy Markdown
Collaborator

Thanks for the heads up!

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.

2 participants