Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "error": {
- "message": "Cannot read property 'DiseaseID' of undefined"
- }
- }
- exports.UserDiseaseInfo = (req, res,next) => {
- let retval = {};
- let body = req.body;
- let UId = (body.UId != undefined) ? body.UId : false;
- let SubDId = (body.SubDId != undefined) ? body.SubDId: false;
- if(UId==false||SubDId==false){
- res.status(404).send({response:"Fail", body: req.body});
- }
- var subd = subDisease_model.findById(SubDId);
- let data = {
- response:'success',
- subDisease : "XX",
- diseaseId : subd[0].DiseaseID
- }
- res.status(200).send(data);
- };
- const mongoose = require('mongoose');
- const AddictionsSchema = new mongoose.Schema({
- DiseaseID : mongoose.Schema.Types.String,
- SubDisease : mongoose.Schema.Types.String
- });
- module.exports = mongoose.model('SubDiseaseMaster', AddictionsSchema, 'SubDiseaseMaster');
- db.SubDiseaseMaster.find({})
- { "_id" : ObjectId("5ad0850efdcab0ab875c4890"), "DiseaseID" : "5ad06decfdcab0ab875c4838", "SubDisease" : "Acidity" }
- POST /api/UserDiseaseInfo HTTP/1.1
- Host: 1nature.in
- Content-Type: application/json
- Cache-Control: no-cache
- Postman-Token: 62e22748-5c30-3f4b-4852-fc0bab68db0d
- {
- "UId":"A",
- "SubDId": "5ad0850efdcab0ab875c48a4"
- }
Add Comment
Please, Sign In to add comment