Schema:
{
A: [
{ _id: "string" },
{ _id: "string" },
{ _id: "string" },
{ _id: "string" },
]
}
Requirement, the A._id
field must be unique for the entire collection, not just unique across the document that it lives.
{
"key": {
"A._id": 1
},
"unique": true,
"partialFilterExpression": {
"A._id": { "$exists": true }
}
}
This did not work