Getting error while loading validateLab1.js

As mentioned in the steps to submit assignment I typed below command to load validateLab1.js and it failed. can someone help me to fix this issue?

MongoDB Enterprise Cluster0-shard-0:PRIMARY> load(‘validateLab1.js’)
2018-08-22T12:10:27.432+0530 E - [thread1] file [validateLab1.js] doesn’t
exist
2018-08-22T12:10:27.433+0530 E QUERY [thread1] Error: error loading js file:
validateLab1.js :
@(shell):1:1

1 Like

Hi,
Please make sure you started the Mongo Shell from the folder containing the validateLab1.js file. Another option is to specify the absolute path to the file in the load function, like this:

load('/absolute_path/validateLab1.js')

José Carlos

2 Likes

You can use the pwd() command to see which folder to move the validation files into.

Thanks for the reply Jose and Shafeh.

Issue here was I had had not copied validate1.js on my system.
I directly used mongo shell installed on my system to submit the assignment. I did not download and copy validate1.js into my local directory before trying to load.

Fixed the issue.

Glad you found the issue!

José Carlos

MongoDB Enterprise Cluster0-shard-0:PRIMARY> load(“validateLab1.js”)
2018-09-06T14:59:07.164+0530 E QUERY [thread1] SyntaxError: missing ; before statement :
@(shell):1:1

2018-09-06T14:59:07.165+0530 E QUERY [thread1] Error: error loading js file: validateLab1.js :
@(shell):1:1

MongoDB Enterprise Cluster0-shard-0:PRIMARY>

i get abover error when try load file

Hi,

Please make sure the validaLab1.js file is in the same directory where you started the mongo shell. Another option is to specify the absolute path to the file.

José Carlos

I am using the Mongo Shell (mongosh 0.8.2). The help document is saying the load method is not implemented. Do I have to install the mongodb server on my local machine to complete the course ?

Can I install the community server and still complete the lessons ?

The tool mongosh is not the same as mongo shell. The former still being in beta. The 0 in the 0.x.x version is clue to the expected instability and missing features. Connect with the command mongo rather than mongosh.

2 Likes

I had to install mongo to complete the exercise. No other way around this.

1 Like