Skip to content
Back

Invalid relationship value. Must be either a document ID or a document, array given.

  • 0
  • Databases
  • Cloud
Jamieyes
30 Apr, 2025, 09:02

I'm getting this error when i try to update a document. The collection has a relatipship with 2 other collections. I don't understand why, when i update the document, i am getting this error thrown since i am only updating 3 attribute, not relating to the relationships... and the documentId is defiantly a string.

This is the code updating the document:

TypeScript
    const data = {
      prospect_disc_type: prospectDiscType,
      prospect_report_overview: response.prospect_report_overview,
      prospect_engagement_score: engagementScore?.score,
    };

    const updateProspectResponse = await database.updateDocument(
      appwrite.APPWRITE_DATABASE_ID,
      appwrite.PROSPECT_COLLECTION,
      prospectId,
      data
    );
TL;DR
Error message: Developer encountering issue when updating a document due to an invalid relationship value despite not directly modifying relationships in the code. Solution: Double-check the data being updated and ensure that the prospectId is a valid string before calling the update method.
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