让我们假设我有这样嵌套对象模式
var Language = new Schema({
name: { type: String, unique: true, required: true },
pos: [{
name: String,
attributes: [{
name: String
}]
}]
});
的模式将在pos
每个项目,并在attributes
,有_id
?如果我向pos
数组中的name
字段添加唯一索引,那么将对该数组执行唯一性还是对所有条目都是唯一的?
这是不正确的作为Mongoose 4,其中'pos'和'属性'将得到自己的模式。 – 2016-04-22 13:25:10