Is there a way to create a collection with the respective attributes?
TL;DR
The user wants to know how to create a collection with attributes using the Node.js Appwrite SDK. They mention that the provided examples only show how to create a collection without attributes. They speculate that creating string attributes might be involved and provide an example for creating a string attribute. They also mention that more information can be found in the documentation. The user asks if there is a way to create a collection with attributes.
Solution: The user can create a collection with attributes by utilizing the `createCollection` function and specifying the attributes using the appropriate methods (`createStringAttribute`, `createBooleanAttribute`, etc.) for each attribute type. While thethere are no examples how to create a collection with multiple attributes
for example the below examples shows how to create a collection, but not with attributes
TypeScript
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.createCollection('[DATABASE_ID]', '[COLLECTION_ID]', '[NAME]');
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
thou I understand that it has something to do with creating string attributes
TypeScript
const sdk = require('node-appwrite');
// Init SDK
const client = new sdk.Client();
const databases = new sdk.Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
const promise = databases.createStringAttribute('[DATABASE_ID]', '[COLLECTION_ID]', '', 1, false);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
- create collection
- create attributs one by one
Recommended threads
- unlike any other provider, your sites DN...
your nameservers dont work with a funny little CNAME error, which is a weird bug but thats what you get when you try to be the kitchen sink, funny errors.
- general_unauthorized_scope
localhost oauth not working. general_unauthorized_scope error showing. { "message": "User (role: guests) missing scopes ([\"account\"])", "code": 401, ...
- Weird Table Causes Console to break
I dont even know how this even happened looks like the $createdAt and , $id got switched? <@831428608895615056>