What is a Mongoose schema and model?

MongoDB and Mongoose · Freshers

Model answer

A schema defines the fields of a document, their types, defaults and validation rules: new Schema({ name: { type: String, required: true } }). A model, created with mongoose.model('User', schema), is the class you use to create and query documents in that collection.

Learn this topic

Connect Express to MongoDB with Mongoose in the course MERN Stack Full Course: MongoDB, Express, React and Node.js.

Sign in to add your own answer.

More questions