appwrite / appwrite/appwrite

🚀 Enhancement: Add Self-Relationship Support for Collections

Open
#9,471 6 comments 10 reactions 0 assignees View on GitHub
feature / relationships product / databases
Dominant language
TypeScript
Stars
57.4k
Forks
5.7k
Avg merge
14h 50m
Merged PRs (30d)
276

Description

### 🔖 Enhancement description

Currently, Appwrite does not support self-referencing relationships within a collection. This feature request is to allow a collection to have a field that references itself, enabling hierarchical or recursive data structures.

### 🎤 Pitch

Self-referencing relationships are essential for various use cases, such as:
- **Hierarchical Data:** Building structures like categories, threads, comments, or organizational hierarchies.
- **Tree-Like Relationships:** Enabling parent-child relationships within the same collection (e.g., a category having subcategories).
- **Graph-Based Models:** Creating complex interconnections within a dataset.

**Example Implementation:**
- Allow a document in a collection to reference another document within the same collection via a **"Self-Relationship"** field.
- Provide validation to prevent circular dependencies if needed.
- Enable querying/filtering based on these relationships to traverse hierarchical structures efficiently.

### 👀 Have you spent some time to check if this issue has been raised before?

- [x] I checked and didn't find similar issue

### 🏢 Have you read the Code of Conduct?

- [x] I have read the [Code of Conduct](https://github.com/appwrite/.github/blob/main/CODE_OF_CONDUCT.md)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.