Back

Is SSR ID.unique() really unique?

  • 0
  • Databases
  • Flutter
  • Web
Misho
11 Jul, 2024, 15:10
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
Steven
11 Jul, 2024, 15:12

It's a very slim chance there will be a collision. I've never seen one

Misho
11 Jul, 2024, 15:13

Okay, thanks

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more