Automattic / Automattic/mongoose
Make `Query#populate()` and `Document#populate()` no-ops when populating a path with no `ref` or `refPath`, and no `model` option
Open
backwards-breaking
- Dominant language
- JavaScript
- Stars
- 27.5k
- Forks
- 4k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 32
Description
Re: #8946. When using `Model.populate()`, it makes sense to fall back to the `Model` if no `ref`. But when using `Query#populate()`, especially with nested `populate()`, this behavior can lead to some nasty surprises.
Contributor guide
Research direction
Review issue #8946 and trace the Query#populate(), Document#populate(), and Model.populate() entry points, including nested populate() behavior. Confirm that Query#populate() and Document#populate() do nothing when a path has no ref or refPath and no model option, while Model.populate() retains its fallback behavior; add or update coverage for these cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb, node.js
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100