Mongo shell - cant load loadMovieDetailsDataset.js

Hey guys, I just downloaded mongoshell from website (new version called “mongosh”, not “mongo” anymore).

I’m getting this error:

ReferenceError: load is not defined

You have to use mongo, not mongosh. The mongosh is new technology and the syntax is different.

Hi @Jpehcl,

We have not tested our content on mongosh. Please follow the instructions mentioned in the course lecture for downloading and installing mongo shell on your system.


Ok “legacy mongo” worked fine. Thank you.

Btw on mongodb download page, only mongosh es available to download.

As per my knowledge, traditionally mongo shell has been distributed as part of the Enterprise Server or Community Server but I will check with the relevant team.


I ended up downloading mongosh by mistake.

and used

.load loadMovieDetailsDataset.js

as per the documentation Require a file and it worked.

1 Like

Hi @Anjali_Raghav,

I’m glad it worked for you. As you know it’s a new product, so new features are being continuously added to it.

~ Shubham

question your post has .load no parenthesis , no single or double quotes or path
and if a path was it from a windows device using backslash or escaped backslash ( double back slash).
I have tried .load but not getting anywhere despite trying to guess some possibilities listed above.

The function load(filename) should work on both legacy mongo and new mongosh. Documentation for new mongosh about load is

Both are JS (nodejs) based and accept single quotes or double quotes as does JS itself.

On Windows, Linux and probably any JS based plateform you may use unix style forward slash for path separator. On Windows, you may also use the double back slash.

load( "c:/tmp/temp.js" )
// and
load( "c:\\tmp\\temp.js" )

should work.

The mongosh integrated with Compass is another story. The load function is not supported but I do not know why.

1 Like