MongoDB - Installation

Install MongoDB on Windows.

Install MongoDB On Windows

First download the latest release of MongoDB from https://www.mongodb.org/downloadsPlease choose correct version see your MongoDB depending upon your Windows version. To get your Windows version, open command prompt and execute the following command.
C:\>wmic os get osarchitecture
32-bit versions of MongoDB only support databases smaller than 2GB and suitable only for testing and evaluation purposes. Now extract your downloaded file to c:\ drive or any other location. Make sure the name of the extracted folder is mongodb-win32-i386-[version] or mongodb-win32-x86_64-[version]. Next, open the command prompt and run the following command.
C:\>move mongodb-win64-* mongodb
   1 dir(s) moved.
Type following command cd .
C:\>md data
C:\md data\db

If you have to install the MongoDB at a different location, then you need to specify an alternate path for \data\db by setting the path dbpath in mongod.exe.

D:\set up\mongodb
D:\>cd "set up"
D:\set up>cd mongodb
D:\set up\mongodb>cd bin
D:\set up\mongodb\bin>mongod.exe --dbpath "d:\set up\mongodb\data" 
This will show waiting for connections message on the console output, which indicates that the mongod.exe process is running successfully.
D:\set up\mongodb\bin>mongo.exe
MongoDB shell version: 2.4.6
connecting to: test
>db.test.save( { a: 1 } )
{ "_id" : ObjectId(5879b0f65a56a454), "a" : 1 }
Next time when you run MongoDB, you need to issue only commands.
D:\set up\mongodb\bin>mongod.exe --dbpath "d:\set up\mongodb\data" 
D:\set up\mongodb\bin>mongo.exe
Next install the MongoDB by using the following command
apt-get install mongodb-10gen = 2.2.3

Install MongoDB on Ubuntu

Run the following command to import the MongoDB public GPG key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
Create a /etc/apt/sources.list.d/mongodb.list file using the following command.
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' 
   | sudo tee /etc/apt/sources.list.d/mongodb.list
Now issue the following command to update the repository
sudo apt-get update
In the above installation, 2.2.3 is currently released MongoDB version.

Welookups is optimized for learning.Copy right 2018 kumar aditya singh .
All Right Reserved and you agree to have read and accepted our term and condition.
All Rights Reserved.