Creating Multifield Indexes in Mongoose / MongoDB

You call the index method on your Schema object to do that as shown here. For your case it would be something like:

mySchema.index({field1: 1, field2: 1}, {unique: true});

Defining indexes at the schema level is necessary when creating compound indexes.

animalSchema.index({ name: 1, type: -1 });

Reference: http://mongoosejs.com/docs/guide.html#indexes