Difference between revisions of "MongoDB JS Files"
Line 11: | Line 11: | ||
Note, these files are created outside the MongoDB environment. | Note, these files are created outside the MongoDB environment. | ||
− | If you do not know how to use '''vi''' then it is probably easier if you use something like '''NotePad++''' on your PC to create the file, then use a secure file transfer protocol (sftp) programme to transfer it to mi-linux using a client, such as '''FireZilla'''. | + | If you do not know how to use '''vi''' then it is probably easier if you use something like '''NotePad++''' on your PC to create,or amend the file, then use a secure file transfer protocol (sftp) programme to transfer it to mi-linux using a client, such as '''FireZilla'''. |
=== Using FTP === | === Using FTP === |
Revision as of 15:15, 24 October 2016
Main Page >> MongoDB >>MongoDB Workbook >> JavaScript Files
Query Files
The Mongo Shell used mi-linux is an interactive JavaScript interface to MongoDB. As you have seen the mongo shell can be used to query and update your data.
So far the query examples seen are not saved for future use. The data will be stored in the database, but not the queries used.
If you wish to save a query, a text editor should be used to create a .js file. If you are familiar with vi, this can be used on mi-linux (csl-student) to create the file.
Note, these files are created outside the MongoDB environment.
If you do not know how to use vi then it is probably easier if you use something like NotePad++ on your PC to create,or amend the file, then use a secure file transfer protocol (sftp) programme to transfer it to mi-linux using a client, such as FireZilla.
Using FTP
Note when using a FTP client:
- it must be a secure connection, i.e., sftp
- the full hostname is: mi-linux.wlv.ac.uk (or csl-student.wlv.ac.uk)
- the login and username is your normal University username and password
Create a file
Use a text editor you are familiar with and type in the following:
Save the file as:
myQuery.js
Run a JS File
Next Step
Return to the Workbook.