Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

nirinchev
Copy link
Collaborator

@nirinchev nirinchev commented Mar 6, 2025

This adds the sh.isConfigShardEnabled helper for server versions 8.0 and above. It uses listShards and then looks for a shard with _id: 'config'.

Additionally, it adds the sh.listShards helper that calls the listShards admin command.

@nirinchev nirinchev changed the title feat: add sh.isConfigShardEnabled helper feat: add sh.isConfigShardEnabled helper MONGOSH-1919 Mar 6, 2025
@nirinchev nirinchev requested review from addaleax and Copilot March 6, 2025 15:13
@addaleax addaleax changed the title feat: add sh.isConfigShardEnabled helper MONGOSH-1919 feat(shell-api): add sh.isConfigShardEnabled helper MONGOSH-1919 Mar 6, 2025
Copy link
Collaborator

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

Looks good!

Makes me wonder though, do we also want to expose a generic sh.listShards() helper that forwards to adminCommand({ listShards: 1 })? That feels like something that should be there in some form, no?

packages/shell-api/src/shard.ts Outdated Show resolved Hide resolved
@nirinchev
Copy link
Collaborator Author

Yeah - was a bit surprised that it wasn't there already, but figured perhaps it was simple enough that nobody requested it 🤷‍♂️ Happy to add it though - seems useful enough to justify having some autocompletion.

@nirinchev nirinchev requested a review from addaleax March 6, 2025 16:59
@nirinchev nirinchev changed the title feat(shell-api): add sh.isConfigShardEnabled helper MONGOSH-1919 feat(shell-api): add sh.isConfigShardEnabled and listShards helpers MONGOSH-1919 Mar 6, 2025
@nirinchev nirinchev requested a review from gagik March 10, 2025 11:31
@nirinchev
Copy link
Collaborator Author

ping @addaleax - I know you approved the PR, but I did end up adding a listShards command, so figured it's a "big enough" commit, that you might want to take another look 👀

1
);
expect((await sh.status()).value.shards[0].tags).to.deep.equal([]);
expect((await sh.listShards())[0].tags).to.deep.equal([]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

💙

@nirinchev nirinchev merged commit d0132aa into main Mar 11, 2025
135 of 137 checks passed
@nirinchev nirinchev deleted the ni/is-config-shard-enabled branch March 11, 2025 20:34
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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.