why it says `Document with the requested ID already exists` when i try to create documents in bulk
- 0
- Databases
- Web

as the title suggests, I'm trying to create some documents in bulk. it's successfully creating the first two, but after that, it's throwing Document with the requested ID already exists
. the attachment shows my code for creating docs. I think it's something that I've done wrong. otherwise, it wouldn't follow this "complete first two only" pattern. but I don't have any idea how to even debug it. I've tried console.log(ID.unique())
, but it's only printing "unique" as a string. I can't find any flaw in my code as well. and even if my code has some issues, why it's saying Document with the requested ID already exists
. the ID creation part is handled by appwrite with ID.unique()
. isn't?

console.log(ID.unique())
should return unique()
with the parentheses
Can you try to change the first row to such
const { ID } = import('appwrite')

Yes, unique()
is a special keyword for the Appwrite server.
Do you have a unique index on your collection?

you're correct. i had an unnecessary unique index on my collection. and the bug was solved after I deleted the index. but I wonder, what was happening under the hood

it's a misleading error message. we throw a duplicate document error because of the unique index but the error message says it's a duplicate ID.

what's this duplicate document error and why does this exists

because you had a unique index

no no. what I'm asking is, what issue actually appwrite was facing under the hood? when these duplicate document errors are created? I'm just curious cuz I didn't understand what was happening behind the scene, in my case



Recommended threads
- CSV
Hello, is there any way to export my users from collection into CSV?
- Confused whether to use GDrive or Appwri...
I am making a blogging site. right now I'm using GDrive to host the blog post's banner + inline images. my thinking was that since GDrive has 15GB storage I sho...
- getting error while creating membership
i am getting some errors what is the correct way to write this? i am using react and appwrite
