假设我有这样一个架构:
var Language = new Schema({
name: { type: String, unique: true, required: true },
pos: [{
name: String,
attributes: [{
name: String
}]
}]
});
pos
和attributes
中的每个项目都会有一个_id
吗?如果我给pos
数组中的name
字段添加唯一索引,那么唯一性将仅针对该数组强制执行,还是所有条目都是唯一的?
pos
和attributes
将会有它们自己的模式。 - Adam Lockhart