[SOLVED] Creating a new document with no required attributes fails "The document data is missing"
- 0
- React Native
- Cloud
Hi! So I'm trying to generate a new document through a api call and get the error "The document data is missing" when my collection does not required any of the attributes to generate a new one. My method is
export const createEmptyCarSetup = async () => { try { const newEmptyCarSetup = await databases.createDocument( databaseId, carSetupCollectionId, ID.unique(), {} ) return newEmptyCarSetup } catch (error) { throw new Error(error) } }
Am I missing something or is this not the way the wiki mentions how to create default documents? https://appwrite.io/docs/references/cloud/server-nodejs/databases
An empty document?
Yes
Yes
By empty I mean all the attributes will be set to the default value
What if you pass "undefined" for each attribute?
You really shouldn't try and hijack another support post
Yeah so it works if i define every single attribute in the request but that just seems wrong for soemthing that requires no data to be set for any of the attributes
yeah that took me by surprise lol
If you just pass undefined for the data what happens? But I agree, it should work with no data if nothing is required, you can create an issue in the repo.
The problem seems to occur here... https://github.com/appwrite/appwrite/blob/main/app/controllers/api/databases.php#L2818-L2820
Nice! Yeah I'll create a new issue!
[SOLVED] Creating a new document with no required attributes fails "The document data is missing"
Recommended threads
- Cloud function deploy stucks in processi...
Been trying for the last hours to deploy my function but for whatever reason, alwasy stuck on processing!
- One-time Cloud migration blocked by data...
Hi, I’m blocked on a one-time migration from Appwrite Cloud to my self-hosted Appwrite instance. We already fixed the region issue, and the migration now corre...
- All My Project is Gone
Hello everyone, please help. Why have all my projects suddenly disappeared? I received a warning via email about one of my projects being paused. When I clicked...