I have this document structure, the property "Name" must be unique across all documents, as shown above:
{
"_id" : ObjectId("56686341d6389c004c689d5d"),
"Bosses" : {
"B1" : {
"_id" : NumberInt(1),
"Name" : "John"
},
"B2" : {
"_id" : NumberInt(1),
"Name" : "Mary"
}
}
}
{
"_id" : ObjectId("56686341d6389c004c689d6f"),
"Bosses" : {
"B1" : {
"_id" : NumberInt(1),
"Name" : "Mary" // should throw an error
}
}
}
It's possible to create a unique index with this structure?