Skip to content

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Jul 15, 2020

https://jira.mongodb.org/browse/MONGOSH-268

Small fix: the uri passed to the service provider is optional, however when we were fetching connection info to have the mongo version for autocomplete we were running string operations on the uri, which were erroring out. Added a small test to catch in future. Was cool to learn more of the inner workings of mongosh.

I think in future we could make this a bit more streamlined by passing the connection information in from compass into the browser repl/shell api internal state, so we can avoid the extra fetching of connection info inside of mongosh.

Auto completion working in compass-shell:
Jul-15-2020 14-08-15

Was thinking about pulling telemetry into this ticket, but since it involves changes in compass metrics also I opened a new ticket and can work on that: https://jira.mongodb.org/browse/COMPASS-4351

Once we merge this we can have a release of mongosh and pull in the new compass-shell version in compass to pull it into the next compass beta release for 1.22.0

@Anemy Anemy requested a review from lrlna July 15, 2020 12:17

const connectInfo = getConnectInfo(
this.uri,
this.uri ? this.uri : '',
Copy link
Contributor

Choose a reason for hiding this comment

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

We should perhaps add a test for an empty uri in service-provider-core/src/connect-info.spec.ts, just to make sure the rest of the information from this function comes out ok.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call - added a test. I also noticed we didn't have a test script in the service-provider-core package. Is that intended? I added one, commented below.

"compile-ts": "tsc -p tsconfig.json",
"prepublish": "npm run compile-ts",
"test": "mocha -r \"../../scripts/import-expansions.js\" --timeout 60000 --colors -r ts-node/register \"./src/**/*.spec.ts\"",
"test-ci": "mocha -r \"../../scripts/import-expansions.js\" --timeout 60000 -r ts-node/register \"./src/**/*.spec.ts\"",
Copy link
Member Author

Choose a reason for hiding this comment

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

Didn't see these tests being run with the lerna tests, so I added the test script.

Copy link
Contributor

Choose a reason for hiding this comment

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

nice! i don't think this was intentionally left out.

@Anemy Anemy merged commit 54ceabf into master Jul 15, 2020
@Anemy Anemy deleted the MONGOSH-268/fix-autocomplete-in-browser-repl branch July 15, 2020 14: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