googleapis / googleapis/google-cloud-node

`startAfter` doesn't work when given a document ref while an `orderBy` is also present

Open
#7,434 1 comment 2 reactions 1 assignee Claimed by @milaGGL View on GitHub
api: firestore library: nodejs-firestore
Dominant language
TypeScript
Stars
3.2k
Forks
712
Avg merge
2d 3h
Merged PRs (30d)
99

Description

### Please make sure you have searched for information in the following guides.

- [x] Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues
- [x] Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js
- [x] Check our Troubleshooting guide: https://github.com/googleapis/google-cloud-node/blob/main/docs/troubleshooting.md
- [x] Check our FAQ: https://github.com/googleapis/google-cloud-node/blob/main/docs/faq.md
- [x] Check our libraries HOW-TO: https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md
- [x] Check out our authentication guide: https://github.com/googleapis/google-auth-library-nodejs
- [x] Check out handwritten samples for many of our APIs: https://github.com/GoogleCloudPlatform/nodejs-docs-samples

### A screenshot that you have tested with "Try this API".

![Image](https://github.com/user-attachments/assets/bb590433-b12a-4917-9e20-f2dcfde01929)

### Link to the code that reproduces this issue. A link to a **public** Github Repository or gist with a minimal reproduction.

https://github.com/ashtonmoomoo/firestore-bug

### A step-by-step description of how to reproduce the issue, based on the linked reproduction.

1. Clone the repo linked in this issue
2. Install dependencies with `npm i`
3. Update the configuration at the top of `repro.ts`
4. Run `npm run repro`

### A clear and concise description of what the bug is, and what you expected to happen.

I expect supplying a _document reference_ to `startAfter` while a `orderBy` is present to work in the same way as it does when supplying a _document snapshot_ to `startAfter` in the same scenario.

Using the reproduction script in the supplied repo, I expect the `size` of each resulting query snapshot to be 1. The last example query in the script has a size of 0.

### A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **

As illustrated by the example queries in the script, using `startAfter` should behave the same whether it is given a snapshot or a ref, regardless of what other query clauses are present.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.