Mongoose Data Base

·

1 min read

Mongoose Data Base

Today we will learn about the Mongoose database schema.

Firstly we import the Mongoose model from the above code. Inside the Mongoose model, it contains the schema method we use objects inside the schema like the above example elaborates. we use the name key inside the name key we also use another object.

we can define name type, require, and maxLength key. In the required key we use an array and inside the array, we write a true value, which means a name should be required, if you don't provide name then it will display this value Name is required. simliarly all.....