Back

[relationships] Two-way relationship

  • 0
  • Databases
  • Cloud
StefanB
12 Jan, 2024, 15:33

How does Appwrite behave in cyclic dependencies?

Consider following (is for multi tenant): Customer(User, Address, Shop) Shop(List<Customer>) Order(Customer, Shop)

What is the output, if I create a Order and fetch it afterwards.

In my case, I think in the nested json there is the data missing (otherwise it would create infinity children).

  1. Am I right?
  2. How to solve this?
TL;DR
Title: Two-way relationship in Appwrite Question: How does Appwrite handle cyclic dependencies? Example: Customer-Shop-Order relationship TL;DR: When creating an Order and fetching it afterwards, the nested JSON may be missing data due to cyclic dependencies. 1. Correct, the data may be missing in the nested JSON to avoid creating infinite children. 2. To solve this, you can manually fetch the related data using Appwrite's data fetching methods or adjust the data structure to avoid cyclic dependencies.
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