I am trying to update nested objects with Mongoose. But when I receive the request, it looks like this:
{
'example[apple]': 'false',
'example[pear]': 'false',
'example[banana]': 'false',
'example[orange]': 'false',
}
My model looks like this:
email: {
type: String,
index:true,
unique: true,
},
example: {
apple: {type:Boolean, default: true},
banana: {type:Boolean, default: true},
pear: {type:Boolean, default: true},
orange: {type:Boolean, default: true}
}
And the object I am sending looks like this:
var formData = {
example: {
apple: false,
banana: false,
pear: false,
orange: false
}
}
What am I doing wrong?