Skip to content
Back

Clarification on Nested Relationship Behavior

  • 0
  • Databases
  • Cloud
pttn40
30 Oct, 2024, 15:55

I've recently started playing with Appwrite Cloud to evaluate it as an alternative to firebase and thus far have been very pleased. I just started playing with the relationships and am seeing some behavior that is confusing me and was hoping I could get some clarification.

Right now I have two collections (c1 & c2) with a one to many relationship between them. If I try to add an existing relationship with an ID as described in the docs it works, and if I try to create new documents by passing in just the child's data that also works. The issue I am hitting is trying to preform an upsert operation on the children.

According to the docs if I pass a document ID with the child it will create a new document if it does not exsist and update the current one if it does, but does not specify what the document ID field name should be or if the data needs to be structured differently. I assumed $id but when I try to use that I get a 401 unauthorized error (I assume this is bc it may be trying to create an attribute for $id).

Does anyone know how the requests should be structured for sending children with document ids attached to them?

TL;DR
Developers is happy with Appwrite Cloud, is exploring relationships feature. Able to add existing relationship by ID or create new child documents. Facing issue with upsert operation on children, unsure of correct structure for sending children with document IDs attached. Any help on this?
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