push a new document to a relationship

  • 0
  • Databases
13 Apr, 2024, 21:16

hello ! i guess this is not currently possible ? for example to just database.updateDocument with {comments: ['newid']} will overwrite comments with only newid and remove the existing relation. is there a way to just push a new one ? Comments is a one to many (one parent, multiple comments). currently the only way i found it to before get the whole document, extract a list of $id from the comments, and include them in the updateDocument ? this require to get the whole document beforehand.

thanks !

Developers are seeking a way to push a new document to a relationship without overwriting existing data. The current workaround involves querying the entire document and then updating it with the new information, which is not efficient. It seems there's no direct method to achieve this currently.
13 Apr, 2024, 21:17

especially if the parent is large querying it whole every time (relationship don't support select'ing only them afaik) is not ideal


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