Skip to content

Migrate documentation examples to object-based filter syntax#176

Merged
hotlong merged 6 commits intomainfrom
copilot/update-document-examples-query-syntax
Jan 24, 2026
Merged

Migrate documentation examples to object-based filter syntax#176
hotlong merged 6 commits intomainfrom
copilot/update-document-examples-query-syntax

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 23, 2026

Update Documentation Examples to New Query Syntax

This PR updates all documentation examples from the legacy array-based filter syntax to the modern object-based filter syntax.

Plan

  • Analyze repository structure and identify all files with old syntax
  • Update core documentation files in content/docs/
    • All query documentation files updated
  • Update example code files
    • All example files updated
  • Fix CI typecheck errors
    • Added missing query support properties to driver supports objects
    • Updated @objectql/types Driver interface
    • Updated @objectstack/spec DriverInterface
    • Resolved driver implementation conflicts
  • Verify all changes with final CI run

CI Fixes Applied

Issue: TypeScript compilation errors in driver files
Root Cause:

  1. Missing query capability properties in supports object (queryFilters, queryAggregations, etc.)
  2. Type conflict from implementing both Driver and DriverInterface

Solutions:

  1. Added query capability properties to all drivers:

    • packages/drivers/mongo/src/index.ts
    • packages/drivers/sql/src/index.ts
    • packages/drivers/sdk/src/index.ts
    • packages/drivers/memory/src/index.ts (already had them)
  2. Updated type definitions:

    • packages/foundation/types/src/driver.ts - Added query properties to Driver.supports
    • packages/objectstack/spec/src/index.ts - Added query properties to DriverInterface.supports
  3. Removed DriverInterface from driver implementations to avoid type conflicts (drivers now only implement Driver)

All typecheck errors resolved ✅

Original prompt

修改所有的文档例子,使用新的查询语法规范。


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
objectql-site Ready Ready Preview, Comment Jan 24, 2026 0:29am

Request Review

Copilot AI and others added 4 commits January 23, 2026 18:31
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Update all document examples to use new query syntax Migrate documentation examples to object-based filter syntax Jan 23, 2026
Copilot AI requested a review from hotlong January 23, 2026 18:38
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ No Changeset Found

This PR does not include a changeset file.
If this PR includes user-facing changes, please add a changeset by running:

pnpm changeset

@hotlong
Copy link
Copy Markdown
Contributor

hotlong commented Jan 24, 2026

@copilot fix all ci

…erface conflict

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 24, 2026

@copilot fix all ci

Fixed all CI typecheck errors in commit 86cef4e.

The issues were:

  1. Missing query capability properties (queryFilters, queryAggregations, querySorting, queryPagination, queryWindowFunctions, querySubqueries) in driver supports objects
  2. Type conflict from implementing both Driver and DriverInterface simultaneously

Changes made:

  • Added missing query properties to all driver supports objects
  • Updated type definitions in @objectql/types and @objectstack/spec
  • Removed DriverInterface from driver class implementations to resolve type conflicts

All TypeScript compilation errors are now resolved ✅

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ No Changeset Found

This PR does not include a changeset file.
If this PR includes user-facing changes, please add a changeset by running:

pnpm changeset

@hotlong hotlong marked this pull request as ready for review January 24, 2026 01:33
Copilot AI review requested due to automatic review settings January 24, 2026 01:33
@hotlong hotlong merged commit 58a1339 into main Jan 24, 2026
5 checks passed
@hotlong hotlong deleted the copilot/update-document-examples-query-syntax branch January 24, 2026 01:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates all documentation examples from the legacy array-based filter syntax to the modern object-based filter syntax, and adds query capability properties to driver type definitions to resolve TypeScript compilation errors.

Changes:

  • Updated filter syntax from array format [['field', '=', 'value']] to object format { field: 'value' } across all documentation and examples
  • Added query capability properties (queryFilters, queryAggregations, etc.) to the Driver and DriverInterface type definitions
  • Removed DriverInterface from the implements clause of SQL, MongoDB, and SDK drivers to avoid type conflicts

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/foundation/types/src/driver.ts Added query capability properties to Driver.supports interface
packages/objectstack/spec/src/index.ts Added query capability properties to DriverInterface.supports
packages/drivers/sql/src/index.ts Removed DriverInterface from implements clause and added query capability flags to supports object
packages/drivers/sdk/src/index.ts Removed DriverInterface from implements clause and added query capability flags (window functions and subqueries set to false for remote driver)
packages/drivers/mongo/src/index.ts Removed DriverInterface from implements clause and added query capability flags (joins, window functions, and subqueries set to false for MongoDB)
examples/showcase/project-tracker/src/seed.ts Migrated filter from array syntax to object syntax
examples/integrations/express-server/tests/data-api.test.ts Migrated filter from array syntax to object syntax
examples/drivers/fs-demo/src/index.ts Migrated all filter examples to object syntax including comparison operators
examples/drivers/excel-demo/src/index.ts Migrated all filter examples to object syntax including updateMany operation
content/docs/server/microservices.mdx Updated filter example to object syntax
content/docs/reference/spec/validation.mdx Updated async validation examples to use object-based filters
content/docs/reference/api/websocket.mdx Updated WebSocket subscription filter to object syntax
content/docs/reference/api/examples.mdx Migrated complex aggregation and search examples with nested filters and expand operations
content/docs/reference/api/client-sdk.mdx Updated all SDK method examples including updateMany, deleteMany, and count operations
content/docs/modeling/migrations.mdx Updated MongoDB migration examples to object syntax
content/docs/logic/formulas.mdx Updated validation and filter expression examples throughout the documentation
content/docs/getting-started/index.mdx Updated the getting started query example to object syntax
content/docs/data-access/sdk.mdx Migrated all SDK examples including complex filter expressions and React hooks
content/docs/data-access/querying.mdx Updated core querying documentation with new filter syntax and explicit OR examples
content/docs/data-access/index.mdx Updated main data access example to object-based filters
content/docs/data-access/best-practices.mdx Migrated all best practice examples including pagination, aggregation, and optimization patterns
content/docs/ai/coding-assistant.mdx Updated AI assistant examples to demonstrate new filter syntax
Comments suppressed due to low confidence (5)

packages/foundation/types/src/driver.ts:130

  • This overload of beginTransaction() is unreachable, the previous overload will always be selected.
    beginTransaction?(): Promise<any>;

packages/foundation/types/src/driver.ts:135

  • This overload of disconnect() is unreachable, the previous overload will always be selected.
    disconnect?(): Promise<void>;

packages/drivers/mongo/src/index.ts:10

  • Unused import DriverInterface.
import { DriverInterface, QueryAST, FilterNode, SortNode } from '@objectstack/spec';

packages/drivers/sdk/src/index.ts:53

  • Unused import DriverInterface.
import { DriverInterface, QueryAST } from '@objectstack/spec';

packages/drivers/sql/src/index.ts:10

  • Unused imports DriverInterface, SortNode.
import { DriverInterface, QueryAST, FilterNode, SortNode } from '@objectstack/spec';

Comment on lines +59 to +64
queryFilters: true,
queryAggregations: true,
querySorting: true,
queryPagination: true,
queryWindowFunctions: true,
querySubqueries: true
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR adds query capability properties (queryFilters, queryAggregations, etc.) to the SQL, MongoDB, SDK, and Memory drivers, but does not add them to the Excel, FileSystem, LocalStorage, and Redis drivers. These other drivers still implement the DriverInterface which now includes these optional properties. For consistency and completeness, these drivers should also declare their query capabilities in their supports object, even if they set them to false or their actual capability values.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants