How to create unique index within a document only?

I have created index on “channel.name” which is unique within the collection. But I also want “channel.formats.formatName” and “channel.formats.messages.name” unique per document, how to achieve uniqueness of these two fields within the document?
I have multiple documents in my collection as below.

{
//Document 1
    "channel" : {
        "_id" : "1",
        "name" : "switch", 
        "formats" : [ 
            {
            //I do not want to repeat formatName "ISO8583-93" for channel "switch" but I can have this //same formatName for different channel within the same collection
                "formatName" : "ISO8583-93",
                "description" : "ISO Format",
                "fields" : [ 
                    {
                        "name" : "0",
                        "alias" : "MTI",
                        "lenght" : "4",
                        "description" : "",
                        "type" : "FIXED",
                        "dataType" : "",
                        "required" : true
                    }
                ],
                "messages" : [ 
                    {
    //I do not want to repeat messages.name "balanceEnquiry" for channel "switch" but I can have this //same messages.name for different channel within the same collection

                        "name" : "balanceEnquiry",
                        "alias" : "balanceEnquiry",
                        "description" : "balanceEnquiry Request  :  Sender Bank -> MessageHub",
                        "messageIdentification" : "",
                        "messageType" : "",
                        "messageFormat" : "",
                        "fields" : [ 
                            {
                                "name" : "DE_0",
                                "alias" : "MTI",
                                "lenght" : "4",
                                "description" : "",
                                "type" : "FIXED",
                                "dataType" : ""
                            }
                        ]
                    }, 
                    {
                        "name" : "fundTransfer",
                        "alias" : "creditTransfer",
                        "description" : "Funds Transfer Request  :  Sender Bank -> Message Hub",
                        "messageIdentification" : "",
                        "messageType" : "",
                        "messageFormat" : "",
                        "fields" : [ 
                            {
                                "name" : "DE_0",
                                "alias" : "MTI",
                                "lenght" : "4",
                                "description" : "",
                                "type" : "FIXED",
                                "dataType" : ""
                            }
                        ]
                    }
                ]
            }, 
            {
                "formatName" : "ISO20022",
                "description" : "",
                "fields" : [ 
                    {
                        "name" : "0",
                        "alias" : "MTI",
                        "lenght" : "4",
                        "description" : "",
                        "type" : "FIXED",
                        "dataType" : "",
                        "required" : true
                    }
                ]
            }
        ]
    }
}
{
//Document 2
    "channel" : {
        "_id" : "2",
        "name" : "POS", 
        "formats" : [ 
            {
            //I do not want to repeat formatName "ISO8583-93" for channel "POS" but I can have this //same formatName for different channel within the same collection
                "formatName" : "ISO8583-93",
                "description" : "ISO Format",
                "fields" : [ 
                    {
                        "name" : "0",
                        "alias" : "MTI",
                        "lenght" : "4",
                        "description" : "",
                        "type" : "FIXED",
                        "dataType" : "",
                        "required" : true
                    }
                ],
                "messages" : [ 
                    {
                        "name" : "balanceEnquiry",
                        "alias" : "balanceEnquiry",
                        "description" : "balanceEnquiry Request  :  Sender Bank -> MessageHub",
                        "messageIdentification" : "",
                        "messageType" : "",
                        "messageFormat" : "",
                        "fields" : [ 
                            {
                                "name" : "DE_0",
                                "alias" : "MTI",
                                "lenght" : "4",
                                "description" : "",
                                "type" : "FIXED",
                                "dataType" : ""
                            }
                        ]
                    }, 
                    {
                        "name" : "fundTransfer",
                        "alias" : "creditTransfer",
                        "description" : "Funds Transfer Request  :  Sender Bank -> Message Hub",
                        "messageIdentification" : "",
                        "messageType" : "",
                        "messageFormat" : "",
                        "fields" : [ 
                            {
                                "name" : "DE_0",
                                "alias" : "MTI",
                                "lenght" : "4",
                                "description" : "",
                                "type" : "FIXED",
                                "dataType" : ""
                            }
                        ]
                    }
                ]
            }, 
            {
                "formatName" : "ISO20022",
                "description" : "",
                "fields" : [ 
                    {
                        "name" : "0",
                        "alias" : "MTI",
                        "lenght" : "4",
                        "description" : "",
                        "type" : "FIXED",
                        "dataType" : "",
                        "required" : true
                    }
                ]
            }
        ]
    }
}

I’d be interested in the answer for this.

In case you dont get any, you might want to think about changing the schema a little, and making formats and object instead of an array, and use the format name as key.

There cannot be two same keys in a sub-document / object.

formats:{
    "ISO8583-93":{
        "description" : "ISO Format",
        "fields" : [ 
            {
                "name" : "0",
                "alias" : "MTI",
                "lenght" : "4",
                "description" : "",
                "type" : "FIXED",
                "dataType" : "",
                "required" : true
            }
        ]
    }
}