I want to create an index on both fields a
and b
but I want the b
field to be unique only I am not sure how can I achieve this in using compound index please help here is the code
var index=collectionMongo("test").createIndex(new BasicDBObject("a", 1))
var index1=collectionMongo("test").createIndex(new BasicDBObject("b", 1),new BasicDBObject("unique", true))
how can i perform my desired task in a compound index please help