Skip to content

fix: display shard key in collection tooltip#670

Open
lte-z wants to merge 2 commits into
microsoft:mainfrom
lte-z:dev/lte_z/shard-key-tooltip
Open

fix: display shard key in collection tooltip#670
lte-z wants to merge 2 commits into
microsoft:mainfrom
lte-z:dev/lte_z/shard-key-tooltip

Conversation

@lte-z
Copy link
Copy Markdown

@lte-z lte-z commented May 21, 2026

Fixes #661

Changes

This PR exposes shard key information for sharded collections in the tree view tooltip.

  • Extended CollectionItemModel to include optional shardKey field
  • Extracted shard key from MongoDB listCollections() response in ClustersClient
  • Rendered shard key in CollectionItem tooltip when present
  • Added localization entry for "Shard Key"

Behavior

  • Sharded collections now display their shard key in tooltip, e.g.:
Database: my-database
Documents: 5.2k
Shard Key: { userId: "hashed" }
  • Non-sharded collections are unaffected (no shard key section shown)

Notes

  • Handles missing or undefined shard key safely
  • Supports both numeric (1) and hashed shard key formats

Copilot AI review requested due to automatic review settings May 21, 2026 13:56
@lte-z lte-z requested a review from a team as a code owner May 21, 2026 13:56
@lte-z
Copy link
Copy Markdown
Author

lte-z commented May 21, 2026

@microsoft-github-policy-service agree

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

Exposes sharding metadata in the DocumentDB tree UI by preserving the shard key from listCollections() and rendering it in the collection tooltip.

Changes:

  • Extend CollectionItemModel with an optional shardKey property populated from listCollections() results.
  • Update CollectionItem tooltip to conditionally display shard key details when present.
  • Add localization string for “Shard Key”.

Reviewed changes

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

File Description
src/tree/documentdb/CollectionItem.ts Adds shard key section to the collection tooltip.
src/documentdb/ClustersClient.ts Extracts and stores shard key from listCollections() into the collection model.
l10n/bundle.l10n.json Adds localized string entry for “Shard Key”.

Comment thread src/tree/documentdb/CollectionItem.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@tnaum-ms
Copy link
Copy Markdown
Collaborator

@lte-z Thank you for your contribution and for addressing Copilot review. I'll review your PR tomorrow.

@tnaum-ms tnaum-ms added the on-hold Approved but not merging yet. Reason in comments. Remove + click Ready for review to release. label May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

on-hold Approved but not merging yet. Reason in comments. Remove + click Ready for review to release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show shard key in collection tooltip 🔑

3 participants