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
- Couldnt not do appwrite push tables
Not sure why i am not able to create my tables
- Problem with Google Workspace at DNS Rec...
Hello, I bought a domain at Namecheap, and Google Workspace used to work there, but now that I switched from Custom DNS to Appwrite's nameservers, it doesn't w...
- Flutter OAuth2 webAuth Bug?
I created with flutter an app where I can login in with my Microsoft Account. When I compile it to Web (WASM) or Android (aab) then there is no problem what so ...