I am trying to save an array of strings into my Database using Mongoose.
So for that, I have declared a variable of a person schema:
var newPerson = new Person ({
tags: req.body.tags
});
The schema itself looks like:
var personSchema = new mongoose.Schema({
tags: Array
});
For saving, refer the following command
newPerson.save(function(err) {
//basic return of JSON
});
With the help of Postman, I send in an array in the body but when I check the database, it only displays one entry with the array as a whole, you can refer to the screenshot:
Any ideas what I have to do?