Skip to content

feat(results): [WIP] Documents view for document databases - #1766

Draft
vinimcorrea wants to merge 6 commits into
TabularisDB:mainfrom
vinimcorrea:feat/documents-view
Draft

vinimcorrea wants to merge 6 commits into
TabularisDB:mainfrom
vinimcorrea:feat/documents-view

Conversation

@vinimcorrea

@vinimcorrea vinimcorrea commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Refs #1531 (not closing it: the follow-up on missing fields vs. stored nulls stays open there).

Plugin side: TabularisDB/tabularis-mongodb-plugin#15

Draft / WIP, opened as agreed in #1531.

A driver whose primary paradigm is document now gets a Documents view next to the grid and the chart, and its toolbar takes Filter and Sort as query documents instead of SQL.

Grid Documents
grid documents
nested filter

(Mock data.)

What changed

  • DocumentView.tsx: one card per row, one field per line. Objects and arrays are summarised and open one level at a time; long strings are cut with the full text in the tooltip; text can be selected and copied; documents render in bounded batches with "load more".
  • utils/extendedJson.ts: decodes MongoDB Extended JSON values ($oid, $date, $numberLong, ...) and shows them the way a Mongo shell writes them, also inside nested objects and arrays.
  • utils/documentView.ts: isDocumentParadigm() and value classification. Only drivers with document as the primary paradigm get the view; SQL drivers are unchanged.
  • ResultViewToggle, useResultChartState, Editor: the toggle offers only the views it is given; the stored default view is respected.
  • TableToolbar: queryStyle="document" relabels the fields Filter and Sort, with query documents as placeholders, sends them exactly as typed, and hides the SQL filter builder and column autocomplete. The default stays SQL.
  • Tests for each of the above.

Known limit

A field a document lacks is shown as null, the same as a stored null. Per #1531 this is left for a follow-up.

Validation

  • tsc --noEmit passes; the new and touched tests pass.
  • The full vitest run has failures that also occur on main (AiProviderIcon, TableTransferModals, set-nightly-version, ...) and pluginGuestStyles, which needs the built host.css.
  • Checked end to end against a MongoDB replica set through the SSH SOCKS5 tunnel.

Get evidence
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Add a read-only Documents view to the result panel of drivers whose
primary paradigm is document: one card per document, one field per line,
objects and arrays folded until opened, values coloured by type. It is the
default view for those drivers; Grid stays one click away. Chart is
unchanged and still limited to query tabs.
… layout

The plugin now sends ObjectId, dates, UUIDs, binary and decimals as
Extended JSON wrappers. The Documents view shows them in shell notation
(UUID('...'), ObjectId('...'), ISO dates); the data grid receives them
flattened to plain text, so it keeps displaying and editing text.

Cards use the elevated surface with a thin border, nested fields get a
guide line, rows highlight on hover.
The app disables text selection globally; opt the document list back in
and keep the fold toggles out of a selection.
For drivers whose primary paradigm is document, the table toolbar shows
FILTER { field: 'value' } and SORT { field: -1 } instead of WHERE and
ORDER BY. The text is sent as written, the SQL filter builder and column
autocomplete are not offered.
@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

This branch has not been deployed

No deployments
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