Back

Relationship not working?

  • 0
  • Databases
  • Functions
paritodev
28 Feb, 2024, 15:47

I have 2 collections in my console : articles and feed_sources.

I have a dart function running where the general flow of the code is as follow :

  • get the documents from feed_sources
  • parse their link attribute to get RSS articles
  • send each articles in the articles collection where each article have a relationship attribute "feedSource" to the feed_source document that was treated to get said article.

The issue: The issue is that my relationship is always null.

  • In the first picture is the attribute section of an article document, the relevant part is the relationship with feed_sources collection with feedSource as the key.
  • In the second picture is an example of the JSON data that is being feeded in the data parameter when creating a document from the function, I believe it is in the same format as in the documentation for creating relationships through references but maybe there's something wrong that I don't see?
  • On the third screenshot, every attributes are correctly set on each created documents except for the relationship attribute witht the key "feedSource" which is N/A null on each of the documents.

Currently, there is only a single document in the feed_sources collection, the id of this source document in the feed_sources collection is directly provided in code to the article by the $id parameter of said document, and I also have verified it manually and can confirm the id in the json output is the correct one: id of the single document in feed_sources, not the id of feed_sources.

I would like some lead as to why this isn't working from someone more experienced with Appwrite as I have as of now, just a few days of experience with it, thanks.

TL;DR
- Developer has two collections: articles and feed_sources - Dart function gets documents from feed_sources, parses links for RSS articles, and saves in articles collection - Issue: relationship attribute 'feedSource' is always null - Screenshots show relationship key, JSON data, and 'N/A' for relationship attribute - Single document in feed_sources, correct id used in code - Seeking help to understand why relationship isn't working Solution: JSON data may not be correctly formatted. Check if 'feedSource' key matches document id in feed_sources collection.
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