
TypeScript
import { Client, Databases, ID } from "appwrite";
const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1')
.setProject('<PROJECT_ID>');
const databases = new Databases(client);
const promise = databases.createDocument(
'<DATABASE_ID>',
'<COLLECTION_ID>',
ID.unique(),
{ "title": "Hamlet" }
);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
Is that ID.unique()
thing really unique because i call this on server? for example waht if two users same time calling function that creates some doc based on that
TL;DR
- Developers are questioning the uniqueness of `ID.unique()` when creating a document on the server
- Slim chance of collision, no seen instances
- No issues even if two users call the function simultaneously
It's a very slim chance there will be a collision. I've never seen one

Okay, thanks
Recommended threads
- Getting Error On self host SSL update
Hi, I am using app write for my app backend version i am using is 1.6.2 yesterday my ssl is expired and now i am not able to renew it because of it my app is no...
- import csv "Document already exists"
When I try to import a csv file to an already existing database, I keep getting "Document Already Exists" I thought that when I import and a document with the ...
- Database not found
Even though I can clearly access and update fields in my DB through the console, when my updating through the Android SDK it throws this error { "message": ...
