I have a array and i trying to insert it with mongoose but in return i got a empty array what i'm doing wrong,
my schema:
let postSchema = mongoose.Schema({
date : { type: Date, default: Date.now },
name : String,
desc : String,
type : []
},{collection: 'Post'});
my insert:
console.log(req.body.type); //here i have something like ["Teste1","Teste2"]
let post = new Post({
name: req.body.descricao,
desc: req.body.desc
type: req.body.type
});
post.save((err, model) => {
if (err) console.log(err);
if (model) console.log(model); //ALL INSERTED but array is just type:[]
})