[SOLVED] Creating a new document with no required attributes fails "The document data is missing"
- 0
- Resolved
- 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
- Appwrite project paused
I have github student account. The auth has been paused however the database is working fine. I cant see any option to resume from my console panel. It is just ...
- Missing Invoice
Hi! I need help with billing on my account (marelu@gmail.com). I have never received a single invoice by email. My organization has been on the Pro plan since...
- Appwrite Functions cold start
Hello. I'm seeing really long cold starts on Appwrite Cloud Functions and wanted to know if this is expected. My function just authenticates the user, fetches ...