Unable to load validateLab1.js

Hi,
When working on the Lab 1 , I try to load the file ValidateLab1.js. But it throws error every time stating that the file does not exist.

Please suggest if I am missing anything.

1 Like

Hey @Archit_14000

You will have to run the shell from the same directory in which the file exists. Is that the case for you?

Thank you for not showing your answer code

1 Like

Thank you @natac13. I moved the validate file to the same folder where mongod.exe was present and it did the trick.

1 Like

hey @natac13 @jcarlosgarcia how can I go to my local machine directory and load the js file from mongo enterprise cluster ? Please help

1 Like

You need to put the file in the shared/ directory to that both local and VM can see it

thanks for your advise but I am using DAAS, mongodb isn’t installed in my VM

Hi @natac13,
I am unable to load the test file through the cluster. Kindly advise.
I have placed my file in the bin : same path as mongod.exe
Thanks,
Vaishnavi

@vaishnavimecit, I think @natac13 is taking a break from here :wink:

You have two options:

  • Come out of the shell, cd to the folder containing the file, log back into mongo and run load(validateLab1.js)

Or

  • Enter the full path:
    load(C:\full\path\to\file\validateLab1.js)
1 Like

Hi,
Thank you for the prompt response. I tried and it didn’t work. I have no idea where I am going wrong!!!

Change all the slashes from “\” to “/”:
load("C:/full/path/to/file/validateLab1.js")

1 Like

Got it!!! Thank you for your time!!!

Hi,
Aggregation returned 23 documents.
load(‘validateLab1.js’) returned true.
validateLab1(pipeline) is giving error.

I found the error… Thanks

1 Like