Back

[Error] Invalid document structure: Unknown Attribute: "creator"

  • 0
  • Android
  • React Native
  • Databases
vikar
2 Aug, 2024, 21:14

I created two collections 1.users 2.products then defined relationship in products with users as one-way | many-to-one | the name of this relation is set as users (I tried rename it to creator but it failed every time)

In a certain page I'm updating product document but it gives this error - [Failed to update product document: Invalid document structure: Unknown attribute: "creator"]

TL;DR
1. Two collections were created on 25 July - 'users' and 'products'. 2. Attributes for 'users' collection: accountId, username, email, password, avatar, address. Attributes for 'products' collection: title, description, category, imageA, imageB, users (relationship with users). 3. Issue arises when attempting to update the product document using the submit function, and the error message states: "Invalid document structure: Unknown attribute: 'creator'". Solution: The error occurs due to the use of the 'creator' attribute which is not recognized. Check the attribute name and make sure it
Steven
2 Aug, 2024, 21:39
  1. When did you create these?
  2. What are the attributes for the collections
  3. What's your code?
vikar
2 Aug, 2024, 21:50

I created the database and collection on 25 July.

users collection has- accountId, username, email, password, avatar, address

products collection has- title, description, category, imageA, imageB, users(relationship with users)

My submit function is like this-

const submit = () => { const updatedProductData = { title: form.title, description: form.description, category: form.category, imageA: form.imageA, imageB: form.imageB, };

// Update the product document await updateProductDocument(form.productId, updatedProductData); } And appwrite function is - [export const updateProductDocument = async (productId, updatedData) => { try { await databases.updateDocument( 'your_database_id', 'your_collection_id', productId, dataToUpdate ); } catch (error) { console.error('Failed to update product document:', error.message); throw error; } };]

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