I am trying to send an array of objects to mongodb using Postman but the subcategory array is always empty.
{
"name": "Category 1",
"subcategory": [
{
"name": "value 1, value2"
}
]
}
My mongoose schema:
const categorySchema = new mongoose.Schema({
name: {
type: String,
required: true,
minlength: 5,
maxlength: 255
},
subcategory: [
{
name: {
type: String
}
}
]
});
My postman settings are "raw", JSON(application/json)