MongoDB tutorial – Mac OS Objectives:
• Download & Install MongoDB on Mac OS
• Start MongoDB on Mac OS
Download MongoDB
Copyright By PowCoder代写 加微信 powcoder
Task 1: Open a web browser and visit the following site
https://www.mongodb.com/download-center#community
Task 2: Download the current stable release of the Mongo community server
This will download a gzip compressed copy (a tgz file) of the binary executable. This lab copies the binary executable file and by passes using a GUI install utility. This is the only way to install MongoDB on Mac OS.
Task 3: Open a terminal window (Applications -> Utilities -> Terminal) Install MongoDB
Figure 1: Terminal Window in Mac OS
Task 4: Decompress the tgz file (double-click on the file).
Task 5: The next few steps involve navigating using Terminal in MacOS
At the $ prompt navigate to the Downloads directory. Type in the content after $, and press Enter.
MongoDB –MacOS Install 1
Please note
Then list the files in your download directory that start with ‘m’
This should list your download file (and other files starting with lowercase “m” in your Downloads directory
Figure 2: ls command showing the file mongo-osx-ssl-x86_64-3.6.3.tgz and the directory mongo-osx-ssl- x86_64-3.6.3 and the files and directories under this directory
You should see the file list similar to above. This means you have the mongodb ready for the next step. Ask your tutor for help if you are not sure.
Create data file directory
The next step is to find a location for your data files. This tutorial is going to place the directory under the Home directory on the macintosh
Starting a MongoDB instance
Normally we would set a parameter to ensure that you could run MongoDB from any directory, but the purpose of this lab is to explore MongoDB not terminal editors. We will start MongoDB from it’s own install directory
Assuming your MongoDB is still in your Downloads folder:
Because we have not used the default directory for MongoDB we need to tell it where the database files will be every time we start MongoDB – using the data directory we just created.
MongoDB –MacOS Install 2
Note the ‘- – functions as a switch – overriding the default location for db files and must be used each time you start MongoDB from the command line.
Figure 5: The mongodb start command (circled in red) has successfully started the Mongodb instance this instance is bound to the “localhost” which means the current device.
MongoDB is now started. Any database files will be written to the /Users/
To stop the MongoDB server type Ctrl+C in the terminal window Installing DatabaseTools
Download the mongodb ‘database tools’ from:
https://www.mongodb.com/try/download/database-tools
These don’t need to be installed, you can leave them in you downloads folder. Unzip them and rename the folder to something simple like ‘mongotools’.
You should now have a folder located at ~/Downloads/mongotools which contains a file called ‘mongoimport’.
NOTE at the time of writing, mongotools only supports x64 (non M1 ARM) macs. This may change in future, check the downloads page!
MongoDB –MacOS Install 3
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com