Automatic type inference for Mongoose 10 discussion - the future of Schema.create()
Author: vkarpov15Created Feb 27, 2026Updated Mar 12, 2026
Labelsdiscussiontypescript
Prerequisites
- I have written a descriptive issue title
- 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:
- Leave it as is - different automatic schema inference in
new Schema()andSchema.create(). Pick which one works for you. - Replace
new Schema()schema inference with whatSchema.create()does - Remove automatic schema inference from
new Schema()- if you usenew Schema(), you are responsible for specifying some/all generics yourself.Schema.create()provides automatic schema inference. - Remove
Schema.create()entirely and leave the current automatic schema inference.
@hasezoey @AbdelrahmanHafez what do you think?
Source: Automattic/mongoose