Document service update() deep-populates the entry lookup, then only uses its id
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, typescript
- Domain
- backend, performance
Research direction
Start in packages/core/core/src/services/document-service/repository.ts and trace how entryToUpdate is used after the lookup. Confirm those consumers only need its id, then check the Content Manager save path that passes buildDeepPopulate(uid). Done when the lookup selects only the id and a save no longer runs the full populate twice.
Written by the indexing model from the issue text.
Description
Node Version
22.20.0
Package Manager
yarn
Package Manager Version
4.12.0
Strapi Version
5.61.0 (develop @ 958568e4ba)
Operating System
MacOS
Database
Other
Javascript or Typescript
Typescript
Bug Description
documents(uid).update() looks up the entry to update with the caller's fields and populate, then only reads its id.
In packages/core/core/src/services/document-service/repository.ts:
const query = transformParamsToQuery(uid, pickSelectionParams(restParams || {}));
const entryToUpdate = await strapi.db.query(uid).findOne({ ...query, where: { …, documentId } });
Every consumer of entryToUpdate (entries.update, the entity validator, components.updateComponents / deleteOldComponents) only reads entryToUpdate.id. The populate is applied again to the updated entry by db.update.
The Content Manager passes buildDeepPopulate(uid) (deep populate of every component, dynamic zone, media and relation count) on save, so each save runs one full deep read whose result is thrown away. On component or dynamic zone heavy types, that is dozens of queries per save.
Steps to Reproduce
- Create a content type with components and a dynamic zone
- Enable query debug logging (
DEBUG=knex:query) - Save an entry in the Content Manager
- See the full populate run twice: once for the lookup, once for the returned entry
Expected Behavior
The lookup selects only the id.
Additional information
Database agnostic: the cost is in application code.
Confirmation Checklist
- I have checked the existing issues for duplicates.
- I agree to follow this project's Code of Conduct.
- Dominant language
- TypeScript
- Stars
- 73.5k
- Forks
- 10k
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 276
Getting set up
- 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 strapi/strapi
-
create-strapi-app doesn't await writing license.txt, so a failed write skips its error handlingOpenflag: invalid template issue: bug severity: low source: cli status: pending reproduction version: 5
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
strapi/strapi#28637 · 1 comment ·
Maintainers usually reply within 2 days
-
Content releases validate entries on every save, even when they are in no releasePossibly taken @hood claimed this 10 days ago. Openissue: bug severity: low source: core:content-releases status: pending reproduction version: 5
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
strapi/strapi#28443 · 3 comments ·
Maintainers usually reply within 2 days
-
Enumeration values used as component entry title are not translatedPossibly taken @breezertwo claimed this 10 days ago. Openissue: bug severity: low source: core:content-manager status: pending reproduction version: 5
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
upload: PUT /upload/settings drops autoOrientation when omitted from the request bodyPossibly taken @Adzouz claimed this 19 days ago. Openissue: bug severity: low source: core:upload version: 5
Difficulty 1/5 Under an hour Newbie friendliness 82/100
strapi/strapi#28228 · 3 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
issue: bug severity: low source: core:content-type-builder status: pending reproduction version: 5
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
strapi/strapi#28227 · 3 comments ·
Maintainers usually reply within 2 days
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
devswha/herdr-web-ui#3875 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
area: runtime chore cli consistency dependencies developer-experience difficulty: easy discovery documentation enhancement good first issue help wanted hygiene json-output packaging priority: P3 tests version
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
discovery:other factory-active task-identify-harness-labels-done task-identify-issue-type-done
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
vercel/ai#25068 · 4 comments ·
Maintainers usually reply within 1 day
-
[Bug] Backend summarize min() / max() panics when a field has no numeric valuesPossibly taken @weng5e claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
grafana/grafana-infinity-datasource#1832 ·
Maintainers usually reply within 1 day