
Hello, I am trying out the new bulk operations feature, and I am experiencing some problem:
I am trying to call database.updatedocuments, and I am passing in the data you can see in the attached screenshot, but I get this error
❌ Server-side rule application failed after 81076ms: AppwriteException: Invalid document structure: Missing required attribute "user_id" at async POST (src/app/api/apply-rules/route.ts:384:19) 382 | 383 | // Wait for batch to complete
384 | const result = await userClient | ^ 385 | .generateServerClient() 386 | .updgradeToAdmin() 387 | .databases.upsertDocuments( { code: 400, type: 'document_invalid_structure', response: '{"message":"Invalid document structure: Missing required attribute "user_id"","code":400,"type":"document_invalid_structure","version":"1.7.4"}' }
but as you can see I have that field filled.
I have tried with bot updateDocuments and upsertDocuments, but the problem is the same. Moveover, in the documentation I see that the payload to send to updateDocuments should be this:
const result = await databases.updateDocuments( '<DATABASE_ID>', '[COLLECTION_ID]', { { documentId: 'document-id-1', data: { name: 'Updated Document 1' } }, { documentId: 'document-id-2', data: { name: 'Updated Document 2' } } } );
Which I think is wrong because it is not a valid javascript object. So I made it an array with those object, but the problem is still there
Recommended threads
- Appwrite Python SDK Not Creating Relatio...
- Type generation without $id parameter
I'm trying for the first time appwrite on 2 projects and after I've tested appwrite types generation with the cli I'm a little bit confused why it doesn't inclu...
- Node.jd 17.1.0 npm publish
Can you please publish the latest version to npm. I just did a big refactoring to improve my code with the new upsert but I can’t publish/test because it’s not ...
