Error in loading validationLab1.js

MongoDB Enterprise Cluster0-shard-0:PRIMARY> load(‘validateLab1.js’)
2021-08-14T11:47:44.056+0530 E - [js] file [validateLab1.js] doesn’t exist
2021-08-14T11:47:44.057+0530 E QUERY [js] Error: error loading js file: validateLab1.js :
MongoDB Enterprise Cluster0-shard-0:PRIMARY>

I was also facing the same issue but reinstalling the MongoDB again will fix.

cd to the directory where your file is residing.Connect to mongodb and then run load command
If you want to run from another location you need to give full path

When I try cd() I get “is not defined”. Can’t find how to navigate to the directory path.

You cannot cd to the directory?
What is your os?
How did you connect to your mongodb?
You may be using some other terminal

You can connect from shell and load the file
Then connect back to mongodb using your program/terminal

I have connected using Compass.

You cannot use Compass to load .js file.It can be used to import csv,json files
Have you installed mongo shell on your system?
Use load method from your mongo shell

re-install mongoshell solved the issue.