Run script files in Mongo Compass

Hello, I created a file with some code and I want to run it as a script in mongosh (in Mongo Compass). The problem I encounter is that I cannot load a file. I tried to use “load” function but I get the message that this method is not implemented yet. I tried to use .load and I get

Error:(#) clone(t={}){const r=t.loc||{};return e({loc:new Position("line"in r?r.line:this.loc.line,“column"in r?r.column:……)} could not be cloned.”.

My question is: It is even possible to run files in Mongo Compass or should I just copy the code from the file and run it directly ?

1 Like

Compass currently does not support loading files. You can either copy-paste the script as you suggested or you can run it with mongosh in the terminal.

Alternatively, if that’s something you do often and you are a VS Code user, I’d recommend checking out MongoDB for VS Code.

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.