Dupliacte records

I have deleted a document, and now trying to insert a new version. However, it seems to think there is still an index entry for the deleted document as it keeps saying key exists when I try to import the new document. How to I get around this, I cannot change the key of the new document

Most likely the document is not deleted.

Share the document, the command you use to try to insert new version, output of running a find using the key.

I’m using compass add document with the following : -

{
“_id” : {
“_id” : ““XXXXXXX”+“37”+“7577”+“08”+“350”+“COMP””
},
“INVSUPP” : “COMP”,
“INVQTY” : “83”,
“INVSIZE” : “350”,
“INVFRCT” : “2022-01-13 00:00:00”,
“INVSTYL” : “7577”,
“INVCREATED_DT” : “2022-01-13 11:28:46”,
“INVDEPT” : “37”,
“INVAMENDED_DT” : “2022-02-01 12:40:19”,
“INVCOMP” : “XXXXXXX”,
“INVCOLR” : “08”
}

You only shared part of what I asked. But anyway the following looks like a funny _id:

Since your _id seems to duplicate a lot of the other fields information, I suggest that you move those fields in the _id.

That’s the format of my key, generated by a CDC system, I don’t have control over the key … this is what it is.

We still need a screenshot while trying to insert the document. And

I would be worry of such a key generation. For example, a INVDEPT of 377 and INVSTYL of 577 would lead to a duplicate key that will be hard to find. Nothing stops you from modify that data your receive from CDC before inserting it in your own DB.

Thanks you were right, document was deleted, but when I find using key is still shows the key, although the rest of the data was deleted, … Fixed thanks

1 Like