-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
created-by: Contributorstatus: needs-triagePossible bug which hasn't been reproduced yetPossible bug which hasn't been reproduced yet
Description
Describe the Bug
When using querying with draft: true and a select, the findByID operation will return the most recent draft version even if there is a more recent published version.
Eg:
- Create a draft document
- Publish the document with changes
- Compare equivalent queries for that document, using both
find()andfindByID()withdraft: trueand aselectfor the changed fields - The results will differ
Link to the code that reproduces this issue
https://github.com/damnsamn/blank-payload-project/tree/issue/findbyid-mismatch-find
Reproduction Steps
Run pnpm test, and see that the tests fail. You can resolve this by commenting out the commonQueryOptions.select property in tests/int/api.int.spec.ts
Which area(s) are affected? (Select all that apply)
area: core, db: mongodb
Environment Info
Binaries:
Node: 23.11.0
npm: 10.9.2
Yarn: 1.22.22
pnpm: 10.17.1
Relevant Packages:
payload: 3.63.0
next: 15.4.7
@payloadcms/db-mongodb: 3.63.0
@payloadcms/graphql: 3.63.0
@payloadcms/next/utilities: 3.63.0
@payloadcms/richtext-lexical: 3.63.0
@payloadcms/translations: 3.63.0
@payloadcms/ui/shared: 3.63.0
react: 19.1.0
react-dom: 19.1.0
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.0.0: Mon Aug 12 20:52:31 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T6030
Available memory (MB): 18432
Available CPU cores: 12
Metadata
Metadata
Assignees
Labels
created-by: Contributorstatus: needs-triagePossible bug which hasn't been reproduced yetPossible bug which hasn't been reproduced yet