#Which npm pkg to use in functions, 'appwrite' or 'node-appwrite'.

1 messages · Page 1 of 1 (latest)

junior horizon
#

I've been successful in creating users in a function with the node-appwrite package, but I'm trying to interact with databases. But there is no "TablesDB" class - it is in the other pkg. Also, some examples ask for a collection id, I see no collection id for my tables - just a table name. I have the latest npm pkg. I've gone through docs but the examples are conflicting or use pre-ES6 "require" and look old. Does anyone have a good working FUNCTION example (using ES6 imports) that interacts with appwrite database/tables (insert/read) I'd appreciate it. Thanks.

junior horizon
#

I also find the concept of table vs collection confusing. The server api docs refer to creating and working with collections and documents, but nothing about working with tables and rows (which is how the tables are designated).

brazen thicket
#

Can't help with the npm package issue, but as far as the TablesDB API is concerned, a collection is now a Table, and each Document is now a Row

#

Collection IDs are the number on the right side of the names

junior horizon
brazen thicket
#

Please post the code and errors and I'll try to help you

#

I have no collection ID

Collection ID should be visible on the right of table names

brazen thicket
#

This is an example of how some server side code created documents:

const newRoomDocRef = await this.databases.createDocument(
         process.env.MASTER_DATABASE_ID,
            process.env.ROOMS_COLLECTION_ID,
            ID.unique(),
            newRoomData
        );
#

uses
"node-appwrite": "^17.0.0"

junior horizon
#

THis is my database (Support), it has one table (captcha), with a table ID but no collection id).

brazen thicket
#

table ID is the same as collection ID

#

The change from Collections/Documents API to the TablesDB API is just decorative, and Tables directly correspond to Collections and Rows directly correspond to Documents

#

so all their attributes are the same as well

junior horizon
#

OK, I'll push up a minimum example to test it out, and report back. thanks,