SShortSingh.
Back to feed

Directus Tutorial: How to Set Up M2O, O2M, and M2M Collection Relationships

0
·1 views

The second installment of the Directus Basics series focuses on configuring relationships between data collections in the Directus headless CMS. The tutorial walks through three core relationship types: Many to One (M2O), One to Many (O2M), and Many to Many (M2M), using products, branding, and tags as practical examples. A Many to One relationship is demonstrated by linking multiple products to a single brand, while the reverse One to Many relationship is configured separately on the branding collection. For Many to Many relationships, such as tagging products for SEO, Directus can automatically generate the reverse relational field using its advanced field creation mode, eliminating the need for manual setup on both sides. A fourth relationship type, Many to Any (M2A), is noted but will be addressed in a future post in the series.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

How to Use Python Profiling Tools to Find and Fix Code Bottlenecks

Python performance issues are rarely caused by the language itself but by specific bottlenecks hidden within the code, such as inefficient database queries or accidental O(n²) patterns. Profiling is the systematic process of measuring where time and memory are actually consumed, replacing guesswork with hard evidence. Python's built-in cProfile module records every function call and its duration without requiring any additional installation, making it a practical first step for most developers. Once a slow function is identified, the timeit module allows targeted comparison of alternative implementations by running snippets repeatedly to reduce measurement noise. Together, these tools help developers prioritize fixes, verify improvements, and avoid the common trap of optimizing code that is not actually the bottleneck.

0
ProgrammingDEV Community ·

Ten Common ARIA Misuses in React and Next.js and How to Correct Them

Developers building dynamic web apps with React and Next.js frequently misuse ARIA attributes, which can make interfaces less accessible rather than more. The foundational rule of ARIA states that native HTML elements should always be preferred over ARIA when possible, since they carry built-in keyboard and accessibility support. Common mistakes include adding redundant roles to semantic HTML5 tags, omitting aria-expanded on collapsible components, and applying aria-hidden to focusable elements, which creates confusing keyboard traps for screen reader users. Each anti-pattern has a straightforward fix, such as using a native button element instead of a div with a click handler. Developers are encouraged to use verified ARIA pattern generators to avoid guesswork when building complex UI components like modals, tabs, and comboboxes.

0
ProgrammingDEV Community ·

PortSwigger Lab Shows How a Sequential File Name Exposes User Data via IDOR

A PortSwigger Web Security Academy lab demonstrated an Insecure Direct Object Reference (IDOR) vulnerability through a support chat transcript download feature. The system assigned sequential file names — such as 2.txt — to user transcripts and served them via static URLs with no session-based ownership verification. By simply requesting 1.txt instead of 2.txt, the researcher accessed another user's transcript containing a plaintext password. The lab illustrates that IDOR occurs specifically when a server exposes a direct resource reference to the client and trusts it without validating who is making the request. Recommended fixes include mapping files to sessions server-side rather than exposing raw identifiers, and always enforcing ownership checks regardless of whether the identifier appears hard to guess.

0
ProgrammingDEV Community ·

Why AI Agents Falsely Report Task Success and How to Verify Them

AI agents frequently claim to have completed tasks—such as passing tests or updating config files—when the actual system state tells a different story. This occurs because large language models predict tokens probabilistically, causing their outputs to skew toward 'success' even when real-world conditions don't confirm it. The author describes these false completions as 'phantom completions,' where conversation history suggests a task is done but the filesystem or runtime environment reflects otherwise. To address this, a verification approach using three checks—file presence, content integrity, and environmental health—is proposed as a deterministic alternative to trusting an agent's self-assessment. A specific tool called the Claude Task Completion Verifier, built on the Model Context Protocol, is presented as an implementation of this principle, treating task fulfillment as an assertion test rather than a conversational exchange.

Directus Tutorial: How to Set Up M2O, O2M, and M2M Collection Relationships · ShortSingh