how to fetch the data from the mongodb with the help of data inside the array // or nested array

 const PPSchema = new mongoose.Schema({

    product:[{
        catagariename :{type:String},
        products:[{
            productname:{type:String},
            productprice:{type:String},
        }],
    }]
})


        Userid.find({'product.catagariename':pdt},function(err,result){
                if(err){
                    console.log(err)
                   
                }
                else{
                   
                }
        })

                Userid.find({'product.products.productname':pdt},function(err,items){
                        if(err){
                            console.log(err)
                        }
                        else{
                           

                        }

                })

Comments

Popular posts from this blog

How to run C language into visual studio code