I mix different types of images in my collection. Each document type calls for a different set of unique ids. 2D images have their own identifyeers, that they do not sharre with the identifiers for 3D images.
Here is a simplified overview of the documents in the collection :
{ _id : ...
, type : 2D'
, 2DimageID : 12345}
{
_id : ...
, type : '3D',
, 3DimageID : 5678
}
I am trying to use $merge on this partial and unique index
db.images.createIndex({'type': 1, '3DimageID': 1},{ partialFilterExpression: { 'type': '3D' }, unique : true})
But get this error:
OperationFailure: Cannot find index to verify that join fields will be unique, full error: {'operationTime': Timestamp(1639405564, 1), 'ok': 0.0, 'errmsg': 'Cannot find index to verify that join fields will be unique', 'code': 51183, 'codeName': 'Location51183', '$clusterTime': {'clusterTime': Timestamp(1639405564, 1), 'signature': {'hash': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'keyId': 0}}}
Am I missing something here ?