Back

Updating database collections

  • 0
  • Databases
  • Flutter
  • Web
  • Functions
tahakhawaja
16 Feb, 2024, 02:29

I am currently trying to use an appwrite function to update and overwrite the data stored in a database collection for users with but the function doesn't seem to be working or called. The data is stored as a string list. Is there something wrong with how i'm calling it?

TypeScript

// Updating user topics
Future<bool> updateUserTopics(String userId, List<String> topics) async {
  try {
    await databases.updateDocument(
      databaseId: '6581a7a98574997f7e84',
      collectionId: '6581a97c17588b1fb066',
      documentId: userId,
      data: {
        'Topics': topics
        },
    );
    print("Topics updated successfully.");
    return true;
  } catch (e) {
    print("Error updating topics: $e");
    return false;
  }
}
TL;DR
The developer is having trouble updating and overwriting data stored in a database collection using an appwrite function. They are using a string list to store the data. They are unsure if there is an issue with how they are calling the function.
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