Skip to content

Add nested relation filter limits - #1690

Closed
GiuseppeXD wants to merge 1 commit into
masterfrom
feature/nested-relation-filter-limits
Closed

Add nested relation filter limits#1690
GiuseppeXD wants to merge 1 commit into
masterfrom
feature/nested-relation-filter-limits

Conversation

@GiuseppeXD

Copy link
Copy Markdown

Description ✍️

Add a limit control to generated Graphoid filters so relation filtering can cap the related criteria before relation operators materialize matching documents.

Overview 🔍

The limit is part of the filtered relation, not the parent query result:

people(where: {
  account: { stringField_contains: "boc", limit: 1 }
}) {
  id
}
  • Generated *Filter types now accept limit: Int.
  • Processor.execute removes the control from normal predicates and applies it after building the criteria.
  • Limits must be positive integers; zero and negative values raise an error instead of becoming an unbounded MongoDB limit.
  • Coverage verifies nested belongs_to filtering and filtering a selected to-many relation.

Checks ☑️

  • Ruby syntax checks pass for all changed source and spec files.
  • git diff --check passes.
  • Targeted Mongoid specs could not run because this checkout's locked dependencies are not installed locally.

Test Guidance

  1. Run DRIVER=mongo bundle exec rspec spec/tester_mongo/spec/graphoid/queries/relations/belongs_to_spec.rb spec/tester_mongo/spec/graphoid/queries/relations/has_many_spec.rb.
  2. Query people(where: { account: { stringField_contains: "boc", limit: 1 } }); expect one matching parent record.
  3. Query a selected relation such as labels(where: { name: "a", limit: 1 }); expect at most one selected related record per parent.
  4. Submit limit: 0 or a negative value through a relation filter; expect an invalid positive-limit error rather than an unbounded result.

@GiuseppeXD

Copy link
Copy Markdown
Author

After discussing with the team, we decided to continue the block filter approach and create new routes for existing features

@GiuseppeXD GiuseppeXD closed this Aug 19, 2026
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