Hey, I am trying to create a basic server function in nodejs that just makes a collection in the database with a unique id.
How would I import id using the same method i have used to import the other modules that you can see in the attachment.
Thanks
If all you want to do is create a new collection with a unique ID, you can do this
let client = new api.Client();
let database = new api.Databases(client);
client
.setEndpoint('[ENDPOINT-HERE]')
.setProject('[PROJECT-ID]')
.setKey('[API-KEY-HERE]')
const promise = databases.createCollection('[DATABASE_ID]', ID.unique(), '[NAME]');
ID.unique()
is a helper function that comes with the appwrite SDK, which generates a unique ID for you.
Reference: https://appwrite.io/docs/server/databases?sdk=nodejs-default#databasesCreateCollection
If you need something more than just this, let me know!
with your import it would be api.ID.unique()
Recommended threads
- Scheduled cloud function
As I understood it is possible to create a function execution from the server sdk with an ISO date as the time. Am I wrong to assume that this will execute the ...
- (Self-Hosted) Dart function deployment b...
Hello everyone, I am currently trying to deploy a dart function on my Appwrite instance (v1.5.7). Due to the need of a corporate certificate to download depende...
- AppwriteException: general_unknown_origi...
Hii all <:KannaWave:657059003410677761> I'm trying to build an simple signup page with dart/flutter and appwrite.. So I'm using Android Studio. Added my flutte...