3
多个密钥如果我想有唯一的任何领域,避免重复我用描述的语法如下独特性与猫鼬
var schema = mongoose.Schema({
projectName : String,
authorName : { type: String, index: true }
});
但是如果我想要对(项目名,AUTHORNAME的价值) 独特。我知道mongodb支持这个,
db.collection.ensureIndex({ a: 1, b: 1 }, { unique: true })
我该如何在猫鼬中写同样的东西?什么是做它的语法。