Advertisement
Guest User

Untitled

a guest
Jan 15th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. var mongoose = require("mongoose")
  2. var authSchema = mongoose.Schema({
  3. username : String,
  4. password : String,
  5. patient : []
  6. });
  7. authSchema.methods.validPassword = function(pwd){
  8. return(this.password === pwd);
  9. }
  10.  
  11. var Doctor = mongoose.model("doctor", authSchema);
  12. module.exports = Doctor;
  13.  
  14. app.post("/insertData", function(req, res){
  15.  
  16. console.log(req.user.username)
  17. Doctor.update({username : req.user.username},
  18. {$push : {"patient" : {
  19.  
  20. doctor : req.body.doctor,
  21. chart : req.body.chart,
  22. last : req.body.last,
  23. first : req.body.first,
  24. address : req.body.address,
  25. city : req.body.city,
  26. state : req.body.state,
  27. zip : req.body.zip,
  28. phove : req.body.phove,
  29. birthDate : req.body.birthDate,
  30. ssn :req.body.ssn
  31. }}, function(err){
  32. if(err){
  33. console.log(err);
  34. }else{
  35. console.log("Success")
  36. }
  37.  
  38. }} )
  39.  
  40. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement