Skip to content

Conversation

@kpatel71716
Copy link
Contributor

@kpatel71716 kpatel71716 commented Oct 21, 2025

Ticket: MONGOSH-2949

Description:

Adds a new sp.listWorkspaceDefaults command to return the (default) tier and maxTier size of the stream processing workspace attached to a stream processor

Screenshot 2025-10-28 at 10 16 43 AM

@kpatel71716 kpatel71716 requested a review from a team as a code owner October 21, 2025 21:01
}

@returnsPromise
async listWorkspaceDefaults() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add a type annotation to this method? I know we're super inconsistent about it, but we'd probably want to move in a direction where we more strictly specify the types and it would be nice if we already do that for all new methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! Not sure if what I did is overboard, I used some other examples I saw. Happy to adjust @gagik

}

@returnsPromise
async listWorkspaceDefaults(): Promise<WorkspaceDefaults | Document> {
Copy link
Contributor

@gagik gagik Oct 28, 2025

Choose a reason for hiding this comment

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

| Document basically means this can also return any other arbitrary object. Is that the case? i.e. could the data be different based on version perhaps? It's fine to be kept like this if we don't have guarantees around it. Which with a database call we generally don't.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is unneeded now. I originally was using this in the case we had an error. But Anna pointed out the code is unreachable so I was able to simplify this, removed Document

const result = await this._runStreamCommand({
listWorkspaceDefaults: 1,
});
if (result.ok !== 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be unreachable – ok: 0 should result in a driver-level exception

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah thank you, I wasn't sure about this since we were checking above. Simplified the implementation here

@kpatel71716 kpatel71716 requested a review from gagik October 28, 2025 14:55
@kpatel71716
Copy link
Contributor Author

just pushed up a fix so ready for another look, attached a screenshot as well showing the command is working with the fieldname change

@kpatel71716 kpatel71716 requested a review from addaleax October 28, 2025 18:48
@addaleax addaleax changed the title feat: add sp.listWorkspaceDefaults command feat(shell-api): add sp.listWorkspaceDefaults command MONGOSH-2949 Oct 28, 2025
@gagik gagik merged commit d19fdba into mongodb-js:main Oct 29, 2025
147 of 155 checks passed
@kpatel71716 kpatel71716 deleted the MONGOSH-2949 branch October 29, 2025 16:32
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.

4 participants