[v4 beta] A tag's `children` join is always empty: documents tagged with `createTagField` never show up
Maintainers usually reply within 1 day
@lazerg is already working on this.
Since Oct 17, 2026.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- mongodb, nodejs, typescript
Research direction
Start with packages/db-mongodb/src/utilities/buildJoinAggregation.ts, especially the multi-collection join comparison described around line 141, and reproduce using pnpm repro:join-limit with the supplied MongoDB setup. Verify the behavior through the tag edit drawer and the REST join query; the change is complete when children.docs includes documents whose tag field contains the queried ID, including multi-value arrays, without regressing the limit: 0 behavior covered separately.
Written by the indexing model from the issue text.
Description
Describe the Bug
What you see: the post "Hello" is tagged with "News". The News page in the admin lists it, but the News tag's own children field shows "No Results." The REST API and Local API return the same: children.docs is [].
Expected: the children join of a tag lists the documents tagged with it, here the post.
| Clicking News in the Tags list: the post "Hello" is listed | Opening News with the cog: children shows "No Results." |
|---|---|
![]() |
![]() |
When it happens: the join spans more than one collection (the hierarchy children join always does: tags and posts) and the linking field holds several values. createTagField holds several values by default, so every tagged document is missing.
Why: for joins over several collections, buildJoinAggregation.ts L141 matches with
{ $expr: { $eq: [`$${join.field.on}`, '$$root_id_'] } }
This compares the whole stored array (_h_tags: [newsId, sportId]) to a single id, so it is never equal. Joins over one collection use localField/foreignField (L400-L402), which does find an id inside an array.
Related: #18812 is a different bug in the same function (limit: 0 crashes). This one also happens with a normal limit like 5.
Link to the code that reproduces this issue
https://github.com/AaronClaes/payload-v4-hierarchy-repro
Reproduction Steps
Needs a local MongoDB.
- Clone the repo, then run
cp .env.example .envandpnpm install. - Run
pnpm repro:join-limit. This creates the tags "News" and "Sport", and a post "Hello" tagged with both. - Run
REPRO_JOIN_LIMIT=10 pnpm dev, open/adminand create a user. (The higher join limit avoids #18812.) - Go to Tags and click News. The page lists the post "Hello" under Posts, so the tag link exists.
- Click the cog icon next to the "News" title to edit the tag. In the drawer, the
childrenfield shows "No Results." It should list "Hello".
The REST API shows the same: /api/tags?joins[children][limit]=5&where[name][equals]=News returns children.docs: [].
Which area(s) are affected?
db: mongodb
Environment Info
Binaries:
Node: 24.15.0
pnpm: 10.17.1
Relevant Packages:
payload: 4.0.0-beta.2
next: 16.4.2
@payloadcms/db-mongodb: 4.0.0-beta.2
@payloadcms/ui: 4.0.0-beta.2
react: 19.3.1
react-dom: 19.3.1
Database: MongoDB 8.3.7
Operating System:
Platform: darwin (arm64)
- Dominant language
- TypeScript
- Stars
- 45.6k
- Forks
- 4.4k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 285
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from payloadcms/payload
-
RelationshipTable: join table with an async server Cell blanks the whole admin when cacheComponents is enabledPossibly taken A pull request linked to this issue is open or already merged. Openarea: ui Bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
payloadcms/payload#19268 · 2 comments ·
Maintainers usually reply within 1 day
-
Form Builder Plugin: an internal link in an email message stops all of the form's emailsPossibly taken @DoctorGuidance claimed this 2 days ago. OpenBug plugin: form-builder status: needs-triage v3
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
payloadcms/payload#19253 ·
Maintainers usually reply within 1 day
-
Required Lexical field accepts two empty paragraphsPossibly taken @lazerg claimed this 4 days ago. OpenBug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#19222 ·
Maintainers usually reply within 1 day
-
area: ui Bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
payloadcms/payload#19198 ·
Maintainers usually reply within 1 day
-
Grid view: show the file placeholder when a thumbnail image fails to loadPossibly taken @lazerg claimed this 5 days ago. OpenBug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
payloadcms/payload#19181 ·
Maintainers usually reply within 1 day
All issues in payloadcms/payload
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
formbricks/formbricks#9918 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
thecodacus/pithagoras#364 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
openclimatefix/quartz-frontend#823 ·
Maintainers usually reply within 4 days
-
area:agent-manager community needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
`contacts.create` posts to `/audiences/undefined/contacts` when `audienceId` is undefinedPossibly taken @RaphaelFakhri claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
resend/resend-node#1176 ·
Maintainers usually reply within 1 day

