2

I am trying to save this data in my mongodb database:

var Student_Answers = {
  matricNumber: matric,
  Answers:  answers  //This is the array answers = ["A", "B"]
};

This is my schema:

var Student_AnswersSchema = mongoose.Schema({
  matricNumber: String,
  Answers: [
    {
      type: String
    }
  ]
});

And this is where the save function is fired

var save = SA(req.body).save(function(err, data) {
  if (err) throw err;
  res.json(data);
});

The matric appears in the database and also the array name but never the contents of the array

enter image description here

0 Answers0