Basically, I was creating a new document in a collection, and I received this error, that the document ID already exist. This is not true, because the old document with the same ID has been deleted, but probably for some reasons it's still in memory. So, how to fix that?
Summary
Developers encountered a bug on custom Document ID where they received an error message about a document ID already existing when it had been deleted. The error message seems misleading and occurs when a unique index is violated. The issue arose due to a relationship inside the collection with another document being one-to-one. A suggested solution is to refresh and try again to resolve the problem.
Kenny
Aug 27, 2024, 16:12
If you refresh and try again what happens?
Bagios
Rank 1: Thread
Aug 27, 2024, 16:28
Nothing at all. But I discovered what happened, and it's a bug on the error displayed. Basically, there was a relationship inside the collection, with another document, one-to-one. And I was trying to add another document with the same relationship, and the one I shared above it's the error displayed.
ideclon
Aug 27, 2024, 17:25
Yeah, I’ve run into that before, I think
Joshi
Aug 27, 2024, 17:27
Also happens when unique index is being violated
Bagios
Rank 1: Thread
Aug 27, 2024, 22:13
I don’t have any index right now
Joshi
Aug 27, 2024, 22:16
Just wanted to say that you do get the same error message when a unique index is being violated. The error message is somewhat misleading in this case