
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
- Multiple Set-Cookie headers collapsed on...
I’m deploying a Next.js 15 app to Appwrite → Deploy → Sites. In app/api/auth/login/route.ts I try to set 3 cookies. Variant A (manual headers): const headers ...
- Bug: When creating a table, table name i...
I created a table with a typo. my_taable .... then my code couldn't find it. i updated table name and still couldn't find it. the table name doesn't update. i h...
- can't send emails
i explored the docs and it says Messaging.CreateEmail() but this function does not exist , i installed appwrite on next js env everything works fine except thi...
