Installing MongoDB

in #utopian-io6 years ago (edited)

This is a simple tutorial on how to Install MongoDB on your PC.

image.png

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:

  1. Download MongoDB.
    Download
    Select the Community Server and specify your Operating System (Windows, Linux, OSX, Solaris) to download.

  2. Extract the folder, rename it to mongo and move it to your user directory.
    Screen Shot 2018-01-11 at 2.25.37 PM.png

  3. 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.

  4. 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)

Screen Shot 2018-01-11 at 2.49.28 PM.png

  1. 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.

Screen Shot 2018-01-11 at 2.55.29 PM.png

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:

Screen Shot 2018-01-11 at 3.00.22 PM.png

lets list our todo. use the command below.

> db.Todo.find()

Result:
Screen Shot 2018-01-11 at 3.00.58 PM.png

If all these commands work perfectly, your MongoDB was correctly installed.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Upvote and Follow you. Follow me and upvote all my posts. Comment 'something' on any of my post and i'll do the same. Come lets earn together @byltc

Upvote and Follow you. Follow me and upvote all my posts. Comment 'something' on any of my post and i'll do the same. Come lets earn together @byltc

Your contribution cannot be approved because it does not follow the Utopian Rules.

This tutorial is too trivial - it involves an installation process, which is usually really easy to follow by yourself. On top of that, hundreds of these can also be found online with a simple google search.

You can contact us on Discord.
[utopian-moderator]