Schema type options
let book2 = new Book({
title: "Marvel Comics",
author: "stan lee",
price: 499,
category: "comics",
})
.save()
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});
NOW THE CONDITIONS:
discount: {
type:Number,
default: 0,
THERE ARE MANY MORE SCHEMA TYPES ,REFER:https://mongoosejs.com/docs/schematypes.html



Comments
Post a Comment