How to design the Schema of monggoose in the node js/express js

 const productSchema = new mongoose.Schema({

    _id:ObjectId,
    catagarie:[{
        catagariename :{type:String},
        products:[{
            productname:{type:String},
            productprice:{type:String},
        }],
    }]

})
const Products = mongoose.model('product',productSchema);
const PPSchema = new mongoose.Schema({
    // name : {type:String,required:true},
    name : {type:String},
    shopname : {type:String},
    phonenumber : {type:String},
    secondarynumber:{type:String},
    email : {type:String},
    dealer:{type:String},
    about:[{
        data:{type:String},
        disc:{type:String}
        // type:String
    }],
    userimg :{
        data:Buffer,
   
    },
    usershopimg : {
        data:Buffer,
   
    },
    product:[{
        catagariename :{type:String},
        products:[{
            productname:{type:String},
            productprice:{type:String},
        }],
    }]
})
const Userid = mongoose.model('userid', PPSchema);

Comments

Popular posts from this blog

How to run C language into visual studio code