I'm new at Mean Stack, I'm trying to get the total value from Database MongoDb using backend and Display at Frontend.
Here is my code.
mainController.js
exports.getQrRecord= function(req,res){
Animal.count( {animalId}, function(err, result){
console.log('count QR',count);
if(err){
res.send(err)
}
else{
res.json(result)
}
})
}
main.service.ts
getqrTotal(){
return this.http.get(this.baseUri+'/qr');
}
main.routes.js
router.get('/record',qr_controller.getQrRecord);
main.component.ts
getQrRecord(){
this.logservice.getqrTotal()
.subscribe((data)=>{
console.log("QrRecord "+data)
if(localStorage.getItem('Institution')=='kyls')
{
this.qrs=data;
}
else{
this.qrs=data;
console.log(this.vt)
this.qrs=this.vt;
}
}
,(err)=>{
console.log(err);
})
}
question from:
https://stackoverflow.com/questions/65682821/how-to-get-total-value-from-mongodb-and-display-at-frontend-in-mean-stack 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…