Skip to content

feat: add Query.relationship helper - #1903

Open
abnegate wants to merge 2 commits into
mainfrom
feat/query-relationship
Open

abnegate wants to merge 2 commits into
mainfrom
feat/query-relationship

Conversation

@abnegate

Copy link
Copy Markdown
Member

Summary

Adds Query.relationship to generated SDKs so clients can constrain populated related documents.

Query.relationship('comments', [
    Query.equal('approved', true),
    Query.orderDesc('$createdAt'),
    Query.limit(25),
])

This matches Query::relationship() / TYPE_RELATIONSHIP in utopia-php/database#968.

The helper takes a relationship attribute and inner queries (filters, order, select, pagination), then serializes them as nested query objects — the same shape as Query.elemMatch.

Languages

PHP, Web/Node, Deno, React Native, Dart/Flutter, Python, Ruby, Kotlin/Android, .NET/Unity, Swift/Apple, Go, Rust.

Skills docs include the new helper.

Test plan

  • Generated PHP Query::relationship unit test (8 assertions)
  • Generated PHP Pint
  • Generated Go gofmt
  • E2E query-helper expectation added for every language that already tests elemMatch
  • CI on this PR

Expose relationship queries on generated Query classes so SDKs can
constrain populated related documents the same way as Query::relationship
in utopia-php/database.
@greptile-apps

greptile-apps Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no actionable regression remains in the current PR changes.

Summary

Adds a Query.relationship helper across the supported generated SDKs, serializing nested filters, ordering, selection, and pagination queries for populated relationship attributes.

  • Implements language-appropriate helper APIs across PHP, TypeScript variants, Dart, Python, Ruby, Kotlin, .NET, Swift, Go, and Rust.
  • Adds generated unit and cross-language E2E coverage for the serialized relationship-query behavior.
  • Documents the helper in each supported SDK skills template.

Reviews (2) · Last reviewed commit: "chore: merge main into feat/query-relati..."

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant