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
- Finding job
Hi. I am a full-stack developer with experience in developing scalable and user-friendly web applications. I handle both front-end and back-end development, im...
- CDN not delivering correct bundle
My site 69b4cd410035893573dc is not delivering the latest deployed version via CDN, it seems stuck on versions from previoiu days, alternative links for the lat...
- Site ID: 6a22303d000c95ef93bdDomain: van...
multiple rapid deployments + a force push to master caused the router to lose the domain-to-deployment binding, even though the Domains tab shows the mapping is...