Back

AppwriteException: Document with the requested ID already exists.

  • 0
  • Databases
oggy765
31 Jul, 2023, 06:29

I am using appwrite in react js. I have Array of data. I am trying to create new document in database. For that I am looping through array of data and creating new document. The first document is successfully created but for the next document i get "Document with the requested ID already exists" error. I am not sure why this issue. I am providing unique iD. I tried with storage and it works perfectly. I am using appwrite version 1.3.8

TL;DR
The user is experiencing an "AppwriteException: Document with the requested ID already exists" error when trying to create a new document in a database using the Appwrite API. They mention that they have a unique ID for each document and have removed all indexes, but the error still persists. They also mention that they have successfully created a new document in a different collection with a unique index. The user is using Appwrite in a React.js application and is looping through an array of data to create new documents. The first document is created successfully, but subsequent documents throw the error. The solution provided by another user is to check for any ty
Kenny
31 Jul, 2023, 13:30

Not sure if this is anything but your database variable is database not databases.

Drake
31 Jul, 2023, 20:51

Do you have a unique index on the collection?

oggy765
1 Aug, 2023, 03:07

my bad, in real code the variable name is right . i was trying to summarize my code to put it here, that time i made typo.

oggy765
1 Aug, 2023, 03:14

yes i have

Drake
1 Aug, 2023, 03:16

It says failed but maybe it sure create... So you can get that error because of the unique index too

oggy765
1 Aug, 2023, 04:05

I removed all indexes and I still get this error. however i created new collection with only two attribute(with unique index) and it is working. in my old collection i do have data which i manually inserted using appwrited dashboard and later i tried to upload using appwrite api. for now i will try few other things.

Drake
1 Aug, 2023, 04:08

Maybe one of the existing documents caused the conflict

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more