Closed tonprince closed 1 year ago
Hmm interesting- yes there does seem to be a bug there. Will investigate.
Actually on second thoughts- having reviewed the code and documentation, this is actually the intended functionality. If a document is added with an _id that is already in use in the index, then all the attributes of the new doc are simply appended to the old one. This allows for some snazzy updating possibilities.
That said, I do agree that it is maybe more intuitive that the "new" document simply replaces the old one, deleting all existing tokens. This could be an addition for v4.x.x
I guess it needs to just be documented clearly and for backwards compability keep it as is and add an alternative way of updating?
I am adding a document with ID XYZ, then updating the same document with new data. I expect not to find anything with old value, but assert failed.
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: 0 !== 1