Skip to content
Back

Database error

  • 0
  • Databases
  • Web
  • Cloud
Popt
12 Jun, 2025, 02:33

My code:

await databases.createDocument( process.env.APPWRITE_DATABASE, process.env.APPWRITE_COLLECTION_USER, data.userId, {}, [ Permission.read(Role.user(data.userId)), Permission.update(Role.user(data.userId)), ] );

It keeps throwing this error at me, but the thing is that all the fields in my user collection are optional, so there is no reason for me to set any fields right?

TL;DR
The user is facing a database error when trying to create a document in a collection, despite all fields being optional. The issue seems to be related to the setup or formatting of the function `databases.createDocument()`. Be sure to check for any missing or incorrect parameters. Be cautious if any specific fields are actually required, even if defined as optional. Consider verifying the syntax and parameters used in the creation method.
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