In this tutorials, we are going to show you how to install MongoDb on Windows 10 operating system.
Install MongoDB on Windows 10 :
Download MongoDB from the offecial website and follow the below steps.
Select your operating system bit size (32 or 64) and click on Download button. It will ask for your basic information like name and email, then click on the download button, you will see the below screen.
Click on archive hyperlink, then MongoDB automatically start downloading and you can see the file name like mongodb-win32-x86_64-enterprise-windows-64-3.6.3.zip
Copy the file into your favorite location and extract it and rename it as MongoDB-[Version].
Goto MongoDB bin folder and you can find the below files init.
Setup MongoDB :
MongoDB requires a data directory to store the information, for this we need to create a folder with the name of data and give that folder path to MongoDB as part of the config file. Else we should create a data directory inside C:\ directory.
If we do not provide any configuration information, by default MongoDB searches the data folder in C:\ directory.
Creating mongo.config file :
mongo.config is a plain text file, it contains data folder path, logs path information and etc.
#Data File Path
dbpath=D:\Softwares\MongoDB-3.6.3\data
#Logs path
logpath=D:\Softwares\MongoDB-3.6.3\log\mongodb.log
Run MongoDB :
We can run the MongoDB server by running mongod.exe
D:\Softwares\MongoDB-3.6.3\bin>mongod --config D:\Softwares\MongoDB-3.6.3\mongod.conf
Now MongoDB server in listining mode. To use the databse and create documents, open another cmd prompt and run the mongo.exe
D:\Softwares\MongoDB-3.6.3\bin>mongo
MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.3
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
Server has startup warnings:
2018-03-07T09:33:41.405-0700 I CONTROL [initandlisten]
2018-03-07T09:33:41.405-0700 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-03-07T09:33:41.405-0700 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-03-07T09:33:41.405-0700 I CONTROL [initandlisten]
2018-03-07T09:33:41.405-0700 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2018-03-07T09:33:41.405-0700 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2018-03-07T09:33:41.405-0700 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
2018-03-07T09:33:41.405-0700 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2018-03-07T09:33:41.405-0700 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2018-03-07T09:33:41.405-0700 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2018-03-07T09:33:41.405-0700 I CONTROL [initandlisten]
2018-03-07T09:33:41.406-0700 I CONTROL [initandlisten]
2018-03-07T09:33:41.406-0700 I CONTROL [initandlisten] ** WARNING: The file system cache of this machine is configured to be greater than 40% of the total memory. This can lead to increased memory pressure and poor performance.
2018-03-07T09:33:41.406-0700 I CONTROL [initandlisten] See http://dochub.mongodb.org/core/wt-windows-system-file-cache
2018-03-07T09:33:41.406-0700 I CONTROL [initandlisten]
MongoDB Enterprise >
By executing the above command, you will be enter in to MongoDB’s shell like above.
MongoDB Databases :
Execute simple MongoDB commands to check.
MongoDB Enterprise > show dbs
admin 0.000GB
config 0.000GB
local 0.000GB
MongoDB gives us above 3 databases (admin,config,local) by default.
Reference :
Happy Learning 🙂