I want to make sure of these two lines (antecedants:[req.query.antecedants] +info.antecedants.push([req.query.antecedants])
as it shown from the code antecedents is an array of string so in my query I want to add an array of string but when I called this method(infopatient
) it adds all the values except the array(empty).
var mongoose = require('mongoose');
//define schema
var Schema= mongoose.Schema;
var ficheSchema= Schema({
Datevisite: Date,
Age:Number ,
Pouls : Number ,
TA : Number ,
temperature : Number ,
FR : Number,
SAO2 : Number ,
CGS : Number,
antecedants : [String] ,
motif : String ,
EVA:Number,
id_patient : String
})
var fiche = mongoose.model('fiche',ficheSchema);
module.exports= fiche ;
//
app.get("/infopatient", (req, res) =>{
var info = new fiches ( {
Age:req.query.Age,
Pouls : req.query.Pouls,
TA:req.query.TA,
temperature:req.query.temperature,
FR:req.query.FR,
SAO2:req.query.SAO2,
CGS:req.query.CGS,
EVA:req.query.EVA ,
antecedants:[req.query.antecedants],
Tmotif:req.query.motif}
);
info.antecedants.push([req.query.antecedants])
info.save(function(err)
{
if(err) return handleError(err);
});
})