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
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...
- Deploy function not working - 503
Hellon i get this error message, when i try to deploy a new version of a function <html><body><h1>503 Service Unavailable</h1>No server is available to handle...
- Error When load the website
Hi, I am getting this error whenever I reload my website please help me, I am using react Error: ** GET https://cloud.appwrite.io/v1/account 401 (Unauthoriz...