Skip to content

feat: implemented getParameter command - #267

Open
jmarkerink wants to merge 1 commit into
bwaldvogel:mainfrom
jmarkerink:feat/getParameter-command
Open

jmarkerink wants to merge 1 commit into
bwaldvogel:mainfrom
jmarkerink:feat/getParameter-command

Conversation

@jmarkerink

Copy link
Copy Markdown
Contributor

No description provided.

@jmarkerink
jmarkerink force-pushed the feat/getParameter-command branch 2 times, most recently from bdeca9c to 4508c1a Compare November 15, 2026 15:41
boolean getAllParameters = "*".equals(value);
boolean showDetails = false;
if (value instanceof Document options) {
getAllParameters = Utils.isTrue(options.get("allParameters"));

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Upstream MongoDB rejects non-boolean values with a TypeMismatch error

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks, will revise it

boolean showDetails = false;
if (value instanceof Document options) {
getAllParameters = Utils.isTrue(options.get("allParameters"));
showDetails = Utils.isTrue(options.get("showDetails"));

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

…same here: boolean type is required, otherwise TypeMismatch

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

.. will revise this too

@jmarkerink
jmarkerink force-pushed the feat/getParameter-command branch 2 times, most recently from 315bf26 to 8c4e08b Compare November 16, 2026 09:42
@Test
void testGetAllParameters() {
Document allParameters = runCommand(json("getParameter: {allParameters: true, showDetails: true}"));
assertThat(allParameters.getDouble("ok")).isEqualTo(1.0);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

can use do a containsOnlyKeys(…) here as well?

@jmarkerink jmarkerink Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Like we did with the hello command, or can we make a difference in this case between the real and memory backend?

I would opt to use containsKeys since the real mongo gives way more parms.

void testGetAllParameters() {
Document allParameters = runCommand(json("getParameter: {allParameters: true, showDetails: true}"));
assertThat(allParameters.getDouble("ok")).isEqualTo(1.0);
assertThat(allParameters.get("featureCompatibilityVersion"))

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

wouldn’t it be simpler and cleaner to write multiple .containsEntry(…)?

@jmarkerink
jmarkerink force-pushed the feat/getParameter-command branch from c17cdc3 to 5bba1b2 Compare November 22, 2026 12:36
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