Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mongoose = require("mongoose")
- var authSchema = mongoose.Schema({
- username : String,
- password : String,
- patient : []
- });
- authSchema.methods.validPassword = function(pwd){
- return(this.password === pwd);
- }
- var Doctor = mongoose.model("doctor", authSchema);
- module.exports = Doctor;
- app.post("/insertData", function(req, res){
- console.log(req.user.username)
- Doctor.update({username : req.user.username},
- {$push : {"patient" : {
- doctor : req.body.doctor,
- chart : req.body.chart,
- last : req.body.last,
- first : req.body.first,
- address : req.body.address,
- city : req.body.city,
- state : req.body.state,
- zip : req.body.zip,
- phove : req.body.phove,
- birthDate : req.body.birthDate,
- ssn :req.body.ssn
- }}, function(err){
- if(err){
- console.log(err);
- }else{
- console.log("Success")
- }
- }} )
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement