Automattic / Automattic/mongoose

Remove `Model.__subclass`

Open
#7,591 0 comments 0 reactions 0 assignees View on GitHub
discussion
Dominant language
JavaScript
Stars
27.5k
Forks
4k
Avg merge
2d 5h
Merged PRs (30d)
32

Description

Re: #7547, `Model.__subclass()` comes with a lot of surprises and is not very clear. To subclass a model, you need to pass the same name and schema into `mongoose.model()`, but a different collection name. This model then isn't stored in the `mongoose.models` hash, so you have an implicit dangling model. We should consider removing this.

Contributor guide

Open the contributing guide

Research direction

Start by reading issue #7547 and locating the Model.__subclass() entry point and its uses in Mongoose. Determine the compatibility impact of removing it, including the mongoose.model() behavior and dangling-model concern; done means the removal decision and affected behavior are covered consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, nodejs
Domain
backend, databases
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.