Run mongo query works from console but not from project file .sql
已回答
I am connected to Atlas Mongodb server. As you can see in the below screenshot when I am connected through a console from Scratches the query works fine

then I drag and drop the scratch file in the projects files where it creates a file with the extension .sql . However, this cannot run, even though it is connected to the same session and collection

I tried changing the extension of the file, with no luck. Any ideas?
请先登录再写评论。
Try to change file extension to


.js
and then it would be possible to Attach Session to file and run queries:Thank you for your reply, I had tried this before, but the play button is greyed out when I do that.
With some investigation, I realized that maybe this has to do with the fact that I don't have an associated *.js file type. There is no JavaScript in the list. I tried to add it to auto-detect, SQL, or even create a new file type - but no luck