I want to add an embedded document, I am using $push
of update, in schema I put the attribute as index: { unique : true }
, but not respecting the rule this is registering item as the same name
Can anyone help me?
var funcionario = new Schema({
nome : { type : String, index : { unique : true } }
});
var empresa = new Schema({
nome : { type : String },
funcionario : [ funcionario ]
});