
in https://appwrite.io/docs/products/databases/relationships#create-documents we create a spiderman movie, with unique ID. ```js const { Client, Databases, ID } = require('node-appwrite');
const client = new Client() .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('<PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
await databases.createDocument(
'marvel',
'movies',
ID.unique(),
{
title: 'Spiderman',
year: 2002,
reviews: [
{ author: 'Bob', text: 'Great movie!' },
{ author: 'Alice', text: 'Loved it!' }
]
}
)
but in the next update section, we update by passing title? not ID?
js
const { Client, Databases } = require('node-appwrite');
const client = new Client() .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('<PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
await databases.updateDocument( 'marvel', 'movies', 'spiderman', { title: 'Spiderman', year: 2002, reviews: [ 'review4', 'review5' ] } ); ``` how does this work?

That wouldn't work, I think it could be displayed like this to show in an easier to digest way that if you want to update the spiderman record use the ID for that record.

might suggest then writing spiderman_ID so no questions would raise

idk maybe its just me

@Kenny i got another question you might answer based on relationships, can we limit the depth that is showing?

I don't think currently you can explicitly limit depth, but a depth of only 3 is shown.

Relationships are still in beta and as such are lacking some crutial features, imo.

i would see depth control as a must

i got dashboard -> action -> job and action-> notification

so if any changes i get a refresh of all the data

i still want to keep the relationships, for administrative purposes

but the amount of incoming data might be overwhelming

dashboard could have like 30 actions, which could have about 150 notifications, that's a lot of data

Yep, I agree. I've run into some limitations with relationships returning far too much data and making requests for documents take 30 seconds.

i love the nested creation though, could be awesome if this could be achieved with out relationships, maybe it is ?

i guess its not, how else would you know in which collection its supposed to go

oh and one last question, is there a way to limit what fields get back to the client ? like private field or something?

like graphql does, but with the sdk ?

On the root document you can use the select query to only return specific columns. Query.select(["column_name"])
Recommended threads
- Stuck in "deleting"
my parent element have relationship that doesnt exist and its stuck in "deleting", i cant delete it gives me error: Collection with the requested ID could not b...
- Help with 409 Error on Relationship Setu...
I ran into a 409 document_already_exists issue. with AppWrite so I tried to debug. Here's what I've set up: Collection A has 3 attributes and a two-way 1-to-m...
- Database Double Requesting Error.
I am getting error for creating new document in an collection with new ID.unique() then too getting error of existing document. When button is pressed one docum...
