Q: How to create index at object level in mongoose My Mongoose schema definition is as follows. 
{
    _id:{
        type:String,
        default:null
    },
    commType: {
        type: String,
        enum: ["mk", "tk"]
    },
    mkSlab:{
        minWgt:{type:Number},
        maxWgt:{type:Number},
        priority:[{type:String}]
    },
    tkSlab:{
        minDays:{type:Number},
        maxDays:{type:Number},
        priority:[{type:String}]
    }
}

When commType is mk, tkSlab will be empty. When commType is tk, mkSlab will be empty. I want to make sure mkslab or tkSlab are unique in each object.
I tried adding unique:true to the mkSlab and tkSlab objects, but failing . I then tried. schema.index({commType:1, mkSlab:1,tkSlab:1},{"unique":true}). It is failing with error cyclic dependency. How can I make sure mkslab or tkslab are unique except when they are empty objects. Thanks in Advance.
