app.post("/showmaterial",(req,res)=>{
purchaseHeaderModel.findOne({
"vendor_code_id.vendor_code":"1"
}).populate("vendor_code_id")
.then((found)=>{
res.json(found)
})
.catch((err)=>res.json(err))
}) //calling api
// these are the schema and showing null result and i am unable to find the solution
const mongoose=require("mongoose");
const vendorSchema=new mongoose.Schema({
vendor_code:{
type:String,required:true,unique:true
},
vendor_name:{
type:String,
required:true
}
});
const purchaseHeaderSchema=new mongoose.Schema({
po_no:{
type:String,required:true,unique:true
},
vendor_code_id:{
type:mongoose.Schema.Types.String,
ref:"vendor_data",
required:true
}
})[quote="Parmesh_Kumar, post:1, topic:208209, full:true"]
app.post("/showmaterial",(req,res)=>{
purchaseHeaderModel.findOne({
"vendor_code_id.vendor_code":"1"
}).populate("vendor_code_id")
.then((found)=>{
res.json(found)
})
.catch((err)=>res.json(err))
}) //calling api
// these are the schema and showing null result and i am unable to find the solution
const mongoose=require("mongoose");
const vendorSchema=new mongoose.Schema({
vendor_code:{
type:String,required:true,unique:true
},
vendor_name:{
type:String,
required:true
}
});
const purchaseHeaderSchema=new mongoose.Schema({
po_no:{
type:String,required:true,unique:true
},
vendor_code_id:{
type:mongoose.Schema.Types.String,
ref:"vendor_data",
required:true
}
})