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 simultaneouslyIt's a very slim chance there will be a collision. I've never seen one
Okay, thanks
Recommended threads
- HUGE OUTRAGE IN APPWRITE, I CANNOT ACCES...
I have 2k users trying to access, sending me messages. What am I supposed to do? Please solve this asap.
- All my apps are not opening now
All my apps are not opening now 200+ apps are not opening plz fast
- Failed to generate functions SSL
```appwrite-worker-certificates | Cannot renew domain (functions.domain.com) on attempt no. 9 certificate: Failed to verify domain DNS records. appwrite-worker...