Hi Faraz
You can use pwd()
to check your current working directory within the mongo
shell. You can also use ls()
to list the contents of the current directory. To load a file into the mongo
shell, you can use the load(<filename>)
method.
You may find these links helpful:
Best regards,
Kevin
Hi
Just to clarify, you can use the mongoimport tool if the homework2.js
file contains data to be imported into MongoDB (e.g. JSON documents, CSV-formatted data, etc.). However, if the homework2.js
file contains Javascript functions, the functions can be loaded into the mongo
shell using the load() method. If you need to run a Javascript file, you can specify the file as a parameter to the mongo
shell, e.g. mongo script.js
(see https://docs.mongodb.com/manual/reference/program/mongo/#bin.mongo)
Best regards,
Kevin