Back

How to get document data in node-appwrite

  • 0
  • Databases
Curzon
3 Jun, 2024, 01:05
TypeScript
const doc = await databases.createDocument(
      DATABASE_ID,
      USERS_COLLECTIONS_ID,
      ID.unique(),
      { user_id: user.user.$id },
    );

// how to get attribute data/values of doc????

Like this for example, how would I obtain the DATA like user_id (and other default values) from the document I just created.....

TL;DR
Developers are struggling to retrieve attribute data/values from a document just created in a node-appwrite project. The Appwrite Documentation lack clarity in this regard. To get attribute data, utilize the `doc.data` method.
Steven
3 Jun, 2024, 01:07

What did you see when you logged doc?

Curzon
3 Jun, 2024, 01:09

Oh I see the values, the Appwrite Documentation never said that there could be more properties in the object

Curzon
3 Jun, 2024, 01:10

I thought there were other functions to obtain the value.

Curzon
3 Jun, 2024, 01:11

I'm a newbie with databases and all of this

Steven
3 Jun, 2024, 01:21

Yes, your document is returned along with all of its data.

Steven
3 Jun, 2024, 01:23
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