Automattic / Automattic/mongoose
Automatic type inference for Mongoose 10 discussion - the future of Schema.create()
- Dominant language
- JavaScript
- Stars
- 27.5k
- Forks
- 4k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 35
Description
### Prerequisites
- [x] I have written a descriptive issue title
- [x] I have searched existing issues to ensure the issue has not already been raised
### Issue
We introduced `Schema.create()` in 9.0 as an experiment in how automatic schema type inference should work going forward. We have a couple of options in Mongoose 10:
1. Leave it as is - different automatic schema inference in `new Schema()` and `Schema.create()`. Pick which one works for you.
2. Replace `new Schema()` schema inference with what `Schema.create()` does
3. Remove automatic schema inference from `new Schema()` - if you use `new Schema()`, you are responsible for specifying some/all generics yourself. `Schema.create()` provides automatic schema inference.
4. Remove `Schema.create()` entirely and leave the current automatic schema inference.
@hasezoey @AbdelrahmanHafez what do you think?
Contributor guide
Assessment
This issue has not been assessed yet.