[text] productModel

Viewer

copydownloadembedprintName: productModel
  1. const mongoose=require('mongoose');
  2. const productSchema=mongoose.Schema({
  3.     productId:{
  4.         type:String,
  5.         required:true,
  6.     },
  7.     imageUrl:{
  8.         type:String,
  9.         required:true,
  10.     },
  11.     productName:{
  12.         type:String,
  13.         required:true,
  14.     },
  15.     price:{
  16.         type:Number,
  17.         required:true,
  18.         default:0
  19.     },
  20.     description:String,
  21.     quantity:String  
  22. });
  23. const productModel=mongoose.model("Product",productSchema);
  24. module.exports=productModel;

Editor

You can edit this paste and save as new:


File Description
  • productModel
  • Paste Code
  • 20 May-2024
  • 518 Bytes
You can Share it: