In this post we will see How to install MongoDB on Mac OS X. MongoDB is one of the most used, open-source document database, and NoSQL database. MongoDB is developed by 10gen.
STEP 1 â Downloading MongoDB
|
2
|
$tar-zxvf mongodb-osx-ssl-x86_64-3.6.1.tgz
$sudo mvmongodb-osx-ssl-x86_64-3.6.1/usr/local/mongodb
|
STEP 2 â Create MongoDB Data directory (/data/db
)
MongoDB stores the data into the /data/db directory by default, so we need to create this directory and also assign proper permission using chown command.
Open the terminal run the following command
Open the terminal run the following command
After downloading, the next step is to install MongoDB on your machine. To install MongoDB, locate the downloaded zip file. Extract this and click on the executable file. Follow the instructions appears on the screen. These instructions will guide you to complete the installation process. Once the installation is complete, you can see a MongoDB folder generated in your C:ProgramFiles folder. It shows that installation is completed successfully.
Setting Up the MongoDB Environment
The next step is setting up the MongoDB environment to get started with MongoDB. You will need to add MongoDB folder path (C:Program FilesMongoDBServer3.4bin) in your systemâs environment variable (PATH variable).
MongoDB also requires a data directory to store all the information. The default data directory path is C:datadb. So, you will also need to create this folder in order to use MongoDB. You can create this folder through command prompt.
Execute the following command sequence:
2
|
If you are using MAC, execute below command sequence:
Now, you have created the required folder and set up MongoDB.
Letâs go ahead and start MongoDB Server and MongoDB Shell (Shell is a full-featured Javascript Interpreter) to play around.
Follow below steps:
- Go to MongoDB folder â> Bin â> Double Click on mongod (to run mongodb)
Alternatively, If you want to start MongoDB using command prompt, run mongod.exeC:Program FilesMongoDBbinmongod.exe
This will start the MongoDB database process. If you get a message âwaiting for connectionâ in the console output, it indicates that the mongodb.exe process is running successfully. Below is the sample snapshot.
Note that default port is 27017.
2) Now, start the Mongo shell to play around with MongoDB basic commands. Bastion pc download crack.
To do this, Go to MongoDB folder â> Bin â> Double Click on mongo
Alternatively, if you want to start MongoDB shell through command prompt, run mongo.exe C:mongodbbinmongo.exe
Below is sample snapshot after starting MongoDB Shell.
Mac Mongodb Client
Note: MongoDB has a JavaScript shell that allows interaction with MongoDB instance from the command line. It is capable of running Arbitrary JavaScript program.
You should start MongoDB before starting the shell because the shell automatically attempts to connect to a MongoDB server on startup.
Basic Commands To Play With MongoDB
To get a list of basic commands, type help() in MongoDB client. This will give you a list of basic commands. Below is the screenshot:
You can also write db.help() to get basic commands related to database.
Install Mongodb On Mac
Thatâs all in this article. We will start MongoDB commands in the upcoming articles. Stay tuned!
- MongoDB Operators Tutorial â What are Different Operators Available? - October 5, 2019
- MongoDB Projection Tutorial : Return Specific Fields From Query - March 9, 2019
- MongoDB Index Tutorial â Create Index & MongoDB Index Types - July 6, 2018
Comments are closed.
Author
Write something about yourself. No need to be fancy, just an overview.
Archives
December 2020
November 2020
October 2020