Validation Script Fails to Load

When I try to load the validation scripts I get the following:
MongoDB Enterprise Cluster0-shard-0:PRIMARY> load(‘validateLab1.js’)
2018-09-21T16:42:00.688-0400 E QUERY [thread1] SyntaxError: missing ; before statement :

2018-09-21T16:42:00.688-0400 E QUERY [thread1] Error: error loading js file: validateLab1.js :

Any idea what the issue is?

open the script in the text editor of your choice. Replace all the ‘let’ keywords (there should be 3 occurrencies) with ‘var’. Save and you should be good to go.
Do the same with the second script: ‘validateLab2.js’. It has more occurrencies of let than the 1st one.

1 Like

That works. Thanks very much.


That’s a valid workaround, but I would suggest to upgrade your mongo shell version. The problem raises because you are likely using a previous shell version, I would suggest to upgrade to 3.6 or 4.0.

José Carlos