This is quite strange. You demand that the primaryKey is always used to check uniqueness here and then you say that is any record that does not have this primarykey value exists then this document is a duplicate.

Is there a reason for these two things?