Skip to content
Back

[SOLVED] Creating a new document with no required attributes fails "The document data is missing"

  • 0
  • React Native
  • Cloud
Kendrick Morales
4 Jan, 2025, 05:23

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

TL;DR
Developers were facing an issue where creating a new document with no required attributes was failing with the error message "The document data is missing." The problem was identified in the code. The solution suggested was to create a new issue on the GitHub repository for further investigation and resolution. The workaround proposed was to define every single attribute in the request or pass "undefined" for each attribute. Ultimately, the workaround for this issue was to set all attributes to their default values for an empty document.
D5
4 Jan, 2025, 09:10

An empty document?

Kendrick Morales
4 Jan, 2025, 18:09

Yes

Kendrick Morales
4 Jan, 2025, 18:09

Yes

Kendrick Morales
4 Jan, 2025, 18:09

By empty I mean all the attributes will be set to the default value

memoonlite
4 Jan, 2025, 19:23

What if you pass "undefined" for each attribute?

Kenny
4 Jan, 2025, 20:01

You really shouldn't try and hijack another support post

Kendrick Morales
4 Jan, 2025, 21:13

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

Kendrick Morales
4 Jan, 2025, 21:13

yeah that took me by surprise lol

Kenny
6 Jan, 2025, 19:29

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.

https://github.com/appwrite/appwrite/issues

Kenny
6 Jan, 2025, 19:31
Kendrick Morales
7 Jan, 2025, 01:56

Nice! Yeah I'll create a new issue!

Kenny
7 Jan, 2025, 02:00

[SOLVED] Creating a new document with no required attributes fails "The document data is missing"

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