A schema defines the shape of a document (fields, types, validation, defaults). A model is a constructor compiled from a schema; it is what you use to query and save documents. Schema is the blueprint; model is the database interface.
Mongoose Schema vs Model: What's the Difference
What is the difference between a Mongoose schema and a model?
The answer
More FAQs in Mongoose Schema vs Model: What's the Difference
Define a schema with new mongoose.Schema({ ... }), then compile a model with mongoose.model('User', userSchema). The model is what you use to create, read, update, and delete documents.
Field types (String, Number, Date, ObjectId), validation (required, min, max, enum, match), defaults, indexes (unique, sparse), virtuals, middleware hooks, and instance/static methods.
Model.create, Model.find, Model.findOne, Model.findById, Model.findByIdAndUpdate, Model.findByIdAndDelete, Model.countDocuments, Model.updateMany. Each returns a promise (with await) or a query (chainable).
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.