0
Greetings dev’s, I have the following schema in my app:
const customerModel = new Schema({
    ...
    roles: [{
        type: String,
        required: true,
        enum: ['user', 'admin'],
        default: 'user'
    }]
})
However, when I enter a new System, if I do not pass a value to roles instead of returning the default value = 'user' an empty array is returned.
Data is being saved in a separate file like this:
exports.createCustomer = async (data) => {
    const customer = new Customer(data)
    await customer.save()
}
What I’m doing wrong here ?
That helps your problem?
– Luiz Felipe
roles shouldn’t be a single object?
– Leandro Angelo