Skip to content

Fix MongoDB ObjectId typing inconsistency in client code #1204

@coderabbitai

Description

@coderabbitai

Problem

The client-side TypeScript interfaces define MongoDB document fields as , but MongoDB typically returns ObjectId objects unless explicitly stringified on the server side. This creates a type safety gap that could lead to runtime issues.

Affected Files

  • components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Presto/PrestoResultsVirtualTable/typings.ts
  • components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/SearchResultsVirtualTable/typings.tsx
  • components/webui/client/src/typings/query.ts

Potential Solutions

  1. Server-side approach: Ensure MongoDB ObjectIds are stringified before sending to client
  2. Client-side approach: Update TypeScript interfaces to accept both string and ObjectId shapes (e.g., string | { $oid: string }), then normalize at usage sites

Context

This issue was identified during code review of PR #1179 where new Presto search results functionality uses MongoDB collections.

Backlinks:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions