If I want to have any field unique and avoid duplications I use the syntax described as follows
var schema = mongoose.Schema({
projectName : String,
authorName : { type: String, index: true }
});
But what if I want to have the value of pairs of (projectName, authorName) unique. I know that mongodb supports this with
db.collection.ensureIndex( { a: 1, b: 1 }, { unique: true } )
How do I write the same thing in mongoose? What is the syntax for doing it.