Skip to content

Commit fc18e43

Browse files
mmarconMassimiliano Marcon
andauthored
Make mongosh the default shell (#306)
* Make `mongosh` the default shell * Updated shell tests Co-authored-by: Massimiliano Marcon <[email protected]>
1 parent 50467c1 commit fc18e43

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Launch the MongoDB Shell from the command palette to quickly connect to the same
4141

4242
![MongoDB Shell](resources/screenshots/shell-launcher.png)
4343

44-
_The shell binary needs to be in your `$PATH`. The shell binary can be either the `mongo` shell or the new [MongoDB Shell](https://www.mongodb.com/products/shell) (`mongosh`). In the extension's settings you can switch between the two._
44+
_The shell binary needs to be in your `$PATH`. The shell binary can be either the new [MongoDB Shell](https://www.mongodb.com/products/shell) (`mongosh`) or the legacy `mongo` shell. In the extension's settings you can switch between the two._
4545

4646
### Terraform snippet for MongoDB Atlas
4747

@@ -51,7 +51,7 @@ If you use Terraform to manage your infrastructure, MongoDB for VS Code helps yo
5151

5252
## Extension Settings
5353

54-
- `mdb.shell`: The MongoDB shell to use (`mongo` or the new `mongosh`).
54+
- `mdb.shell`: The MongoDB shell to use (The new `mongosh` or the legacy `mongo`).
5555
- `mdb.show`: Show or hide the MongoDB view.
5656
- `mdb.defaultLimit`: The number of documents to fetch when viewing documents from a collection.
5757
- `mdb.confirmRunAll`: Show a confirmation message before running commands in a playground.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -767,14 +767,14 @@
767767
"mdb.shell": {
768768
"type": "string",
769769
"enum": [
770-
"mongo",
771-
"mongosh"
770+
"mongosh",
771+
"mongo"
772772
],
773773
"enumDescriptions": [
774-
"Use the legacy mongo shell",
775-
"Use the new mongosh"
774+
"Use the new mongosh",
775+
"Use the legacy mongo shell"
776776
],
777-
"default": "mongo",
777+
"default": "mongosh",
778778
"description": "The MongoDB shell to use."
779779
},
780780
"mdb.showMongoDBConnectionExplorer": {

src/test/suite/commands/launchMongoShell.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ suite('Commands Test Suite', () => {
3838

3939
createTerminalStub.returns({
4040
sendText: fakeSendTerminalText,
41-
show: () => {}
41+
show: () => { }
4242
});
4343
sandbox.replace(vscode.window, 'createTerminal', createTerminalStub);
4444
});
@@ -95,7 +95,7 @@ suite('Commands Test Suite', () => {
9595

9696
const shellCommandText = fakeSendTerminalText.firstCall.args[0];
9797

98-
assert.strictEqual(shellCommandText, 'mongo $MDB_CONNECTION_STRING;');
98+
assert.strictEqual(shellCommandText, 'mongosh $MDB_CONNECTION_STRING;');
9999
});
100100

101101
test('openMongoDBShell should open a terminal with ssh tunnel port injected', async () => {
@@ -123,7 +123,7 @@ suite('Commands Test Suite', () => {
123123

124124
const shellCommandText = fakeSendTerminalText.firstCall.args[0];
125125

126-
assert.strictEqual(shellCommandText, 'mongo $MDB_CONNECTION_STRING;');
126+
assert.strictEqual(shellCommandText, 'mongosh $MDB_CONNECTION_STRING;');
127127
});
128128

129129
test('openMongoDBShell should open a terminal with ssl config injected', async () => {
@@ -154,7 +154,7 @@ suite('Commands Test Suite', () => {
154154

155155
const shellCommandText = fakeSendTerminalText.firstCall.args[0];
156156

157-
assert.strictEqual(shellCommandText, 'mongo --tls --tlsAllowInvalidHostnames --tlsCAFile="./path_to_some_file" $MDB_CONNECTION_STRING;');
157+
assert.strictEqual(shellCommandText, 'mongosh --tls --tlsAllowInvalidHostnames --tlsCAFile="./path_to_some_file" $MDB_CONNECTION_STRING;');
158158
});
159159

160160
test('openMongoDBShell should open a terminal with x509 config injected', async () => {
@@ -184,7 +184,7 @@ suite('Commands Test Suite', () => {
184184

185185
const shellCommandText = fakeSendTerminalText.firstCall.args[0];
186186

187-
assert.strictEqual(shellCommandText, 'mongo --tls --tlsAllowInvalidHostnames --tlsCAFile="./path_to_ca" --tlsCertificateKeyFile="./path_to_cert" $MDB_CONNECTION_STRING;');
187+
assert.strictEqual(shellCommandText, 'mongosh --tls --tlsAllowInvalidHostnames --tlsCAFile="./path_to_ca" --tlsCertificateKeyFile="./path_to_cert" $MDB_CONNECTION_STRING;');
188188
});
189189
});
190190

@@ -247,9 +247,9 @@ suite('Commands Test Suite', () => {
247247
terminalOptions.env?.MDB_CONNECTION_STRING?.includes(
248248
'mongodb://127.0.0.1'
249249
) &&
250-
terminalOptions.env?.MDB_CONNECTION_STRING.includes(
251-
'/?readPreference=primary&ssl=false'
252-
),
250+
terminalOptions.env?.MDB_CONNECTION_STRING.includes(
251+
'/?readPreference=primary&ssl=false'
252+
),
253253
`Expected open terminal to set shell arg as driver url with ssh tunnel port injected found "${terminalOptions.env?.MDB_CONNECTION_STRING}"`
254254
);
255255
});
@@ -349,9 +349,9 @@ suite('Commands Test Suite', () => {
349349
terminalOptions.env?.MDB_CONNECTION_STRING?.includes(
350350
'mongodb://127.0.0.1'
351351
) &&
352-
terminalOptions.env?.MDB_CONNECTION_STRING.includes(
353-
'/?readPreference=primary&ssl=false'
354-
),
352+
terminalOptions.env?.MDB_CONNECTION_STRING.includes(
353+
'/?readPreference=primary&ssl=false'
354+
),
355355
`Expected open terminal to set shell arg as driver url with ssh tunnel port injected found "${terminalOptions.env?.MDB_CONNECTION_STRING}"`
356356
);
357357
});

0 commit comments

Comments
 (0)