Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to use the Load command in the playground #263

Open
MullinsN opened this issue Feb 15, 2021 · 8 comments
Open

Ability to use the Load command in the playground #263

MullinsN opened this issue Feb 15, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@MullinsN
Copy link

MullinsN commented Feb 15, 2021

Feature Request

It would be really useful to use the load command within the playground.

Detailed Description

It is something that is not supported since there is a message that indicates that it isn't so, when I try to use it, though it could be a generic message for all unsupported commands.

load("validateLab1.js");

Context

At the moment going through the aggregation pipeline course again, and it's uses the load command for the validation proportion of the labs to return the number that you enter if the aggregation pipeline is correct.

I can copy the validate code into the playground and run it that way, but it means my playground becomes full of validate code and not the actual code of importance, the aggregation pipeline.

The more people who use the extension within better support earlier on (such as within VSC), will have a more joyful experience with MongoDB, because it is a real pain in the arse using the command shell, with the aggregation pipeline.

The inbuilt shell that is used on the M001 basics course, is again the wrong way to go forward.

Possible Implementation

Who knows how it's going to be implemented, it's easier to suggest things than have to do the work to create them.

@mmarcon
Copy link
Member

mmarcon commented Feb 16, 2021

@MullinsN we are currently planning the work for load() in mongosh. Once we have it done in mongosh it should mostly work out of the box in playgrounds.

@MullinsN
Copy link
Author

Thank you for the notification.

Hopefully the implementation will be painless as possible.

Out of interest, you mention mongosh, this is different to the mongo shell? .... Ah this is you ?

https://www.mongodb.com/blog/post/introducing-the-new-shell

It is good to see that it's been broken out of the mongo command for more rapid development.

Do you know when the mongosh will be able to provide understanding of it's context so it can prompt for comparison query operators via intellisense?

@mmarcon
Copy link
Member

mmarcon commented Feb 17, 2021

Yes, that is me :)

mongosh is the new MongoDB Shell. We rebuilt from scratch to improve the user experience and to make it embeddable in other places. You can still install it as a standalone CLI command and use it in the terminal but you can find it also embedded into Compass and it is the runtime that powers playgrounds in VS Code.

Over time, you might see it available also in other places, and we will expand its functionality as we expand our cloud platform offering on Atlas.

Intellisense is a topic we are exploring from different angles and we are looking at different options to make it smarter. Happy to chat about this if you'd like. Feel free to grab a slot in my calendar.

@MullinsN
Copy link
Author

MullinsN commented Feb 18, 2021

I will not take any of your time up, though thanks for the offer.

I did notice that on 0.42 you have added a refresh of documents icon. Slightly related, how does the extension (mongosh) work out shape of the document? Does it work in a similar way to the analyse tool in compass?

The reason I am thinking not, is that I had a simple couple of test documents, where the intellisense picked up the first document field names, but not the second one.

If you do implement compass like 1000 documents analysis model, make the analysis work automatically the first time of connection to a collection, cache it, and use that cached version, unless the user presses "refresh" document schema. It is a small quibble I have with compass, that each time you connect to compass, the analyze schema doesn't remember the previous document shape of a collection.

@Anemy
Copy link
Member

Anemy commented Feb 18, 2021

@MullinsN Currently we're parsing the shapes of documents using this same module compass uses: https://github.com/mongodb-js/mongodb-schema

The intellisense autocomplete is not using the same schema sample as the tree view collections schema at the moment. I do like what you're getting at there though that bringing them together could allow users to be more in control of the cache. Currently the autocomplete parses one document and the tree view schema parses 10. (At some point we'd like to make this a configurable setting).

Thanks for all the feature requests - hopefully we can get to all of them in time :)

@Anemy Anemy added the enhancement New feature or request label Feb 18, 2021
@libinvarghese
Copy link

Even after load is supported in mongosh, I am still unable to use load in the playground. I get the following error.

[COMMON-90002] load is not currently implemented for this platform

I am able to use load in mongosh.

vscode:                 1.55.0
mongodb.mongodb-vscode: v0.6.10
Using MongoDB:          4.4.1
Using Mongosh:          1.1.0
macOS:                  10.13.6

@mmarcon
Copy link
Member

mmarcon commented Nov 5, 2021

Hi @libinvarghese. We have not exposed the load() implementation in VS Code playgrounds yet. Can you share a bit about your use-case?

@yilmazdurmaz
Copy link

@mmarcon have you seen MongoDB University courses? this load ability would come in handy when validating course material, if it worked :)

anyways, the extension seems handy itself but with growing query size, it will not be feasible to use it anymore unless this load functionality is made to work. it is the way to write long functions into separate files and import them into the playground (the shell for mongo/mongosh).

And also the extension itself is not called "a playground for mongodb". That means this extension has a future to be a great tool we can use without leaving VSCode ever, and load ability is one key feature we need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants