This is a simple tutorial on how to Install MongoDB on your PC.
About MongoDB
MongoDB (from humongous) is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas. MongoDB is developed by MongoDB Inc. and is published under a combination of the GNU Affero General Public License and the Apache License.
source: wikipedia
Tutorial:
Download MongoDB.
Download
Select the Community Server and specify your Operating System (Windows, Linux, OSX, Solaris) to download.Extract the folder, rename it to
mongo
and move it to your user directory.
Create a new Directory in your user directory alongside mongo called
mongo-data
. This is for storing the actual data that is inside the database.Using your terminal, cd to the bin in the mongo directory and enter this command below. This is to start up the server.
./mongod --dbpath ~/mongo-data
you should see something like this (below)
- Now, lets test if the installation is working. Open another tab on your terminal (CMD T), the bin directory would still be there. Then enter
$ ./mongo
. We should see something like the screenshot below.
With this , we can now type in some commands.
first, lets insert some text.
> db.Todo.insert({text: 'learn mongodb'})
This inserts learn mongodb to the database.
Result:
lets list our todo. use the command below.
> db.Todo.find()
Result:
If all these commands work perfectly, your MongoDB was correctly installed.
Posted on Utopian.io - Rewarding Open Source Contributors