
How can I add programmatically a new element into an existing enum attribute that is not empty? I am using node sdk.

databases.updateEnumAttribute gives me this error "databases.updateEnumAttribute is not a function". Could this be a bug?

I am using appwrite cloud

@driver can you give whole code plz. It is difficult to help without more information

import { Client, Databases } from "node-appwrite";
export default async function handler(req, res) { const client = new Client(); client .setEndpoint(process.env.APPWRITE_ENDPOINT) .setProject(process.env.APPWRITE_PROJECT_ID) .setKey(process.env.APPWRITE_DATABASE_API_KEY);
const database = new Databases(client);
const databaseId = process.env.APPWRITE_DATABASE_ID_USERS; const collectionId = process.env.APPWRITE_DATABASE_COLLECTION_ID_POSITIONS; const data = req.body;
if (req.method === "POST") { try { console.log(data.categoryList); // ["Academic", "Technican", "Admin", "Test"] //test is a newly added enum by clinet const response = await database.updateEnumAttribute( databaseId, collectionId, "category", data.categoryList, true );
res.status(200).json(response); // nothing
} catch (error) {
console.log(error.message); // error database.updateEnumAttribute is not a function
res.status(500).json({ error: error.message });
}
} }

Tips : you can format your code with : https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline-#h_01GY0DAKGXDEHE263BCAYEGFJA
import { Client, Databases } from "node-appwrite";
export default async function handler(req, res) {
const client = new Client();
client
.setEndpoint(process.env.APPWRITE_ENDPOINT)
.setProject(process.env.APPWRITE_PROJECT_ID)
.setKey(process.env.APPWRITE_DATABASE_API_KEY);
const database = new Databases(client);
const databaseId = process.env.APPWRITE_DATABASE_ID_USERS;
const collectionId = process.env.APPWRITE_DATABASE_COLLECTION_ID_POSITIONS;
const data = req.body;
if (req.method === "POST") {
try {
console.log(data.categoryList); // ["Academic", "Technican", "Admin", "Test"] //test is a newly added enum by clinet
const response = await database.updateEnumAttribute(
databaseId,
collectionId,
"category",
data.categoryList,
true
);
res.status(200).json(response); // nothing
} catch (error) {
console.log(error.message); // error database.updateEnumAttribute is not a function
res.status(500).json({ error: error.message });
}
}
}

thanks, I am using nextjs

1.3 isn't already implemented on nodejs sdk, so you havn't all update endpoint, etc..

Check diff between


and


Okay, I see. Thanks

I think that's where it comes from. But prefer a confirmation from an appwrite staff @Steven



I suggest you to build your own rest or graphql client

That's what we did, to take advantage of the new features immediately

Thank you for the help @Bouahaza

do you have an idea when appwrite cloud will use the newer version?!

Not know, when beta closed ?

1.3 merged on master branch (https://github.com/appwrite/appwrite/pull/5432) So it should happen soon
Recommended threads
- Problems with adding my custom domain
- CSV Not Importing
We don’t seem to having any luck importing a simple .csv file. The import function acts like it’s working but no data imports or is shown in the collection The...
- Appwrite Cloud Custom Domains Issue
I’m trying to configure my custom domain api.kondri.lt (CNAME pointing to appwrite.network., also tried fra.cloud.appwrite.io with no luck ) but encountering a ...
