How To Install Mongodb In Windows 10
The installers for MongoDB are available in both the 32-bit and 64-bit format. The 32-bit installers are good for evolution and exam environments. But for product environments yous should utilise the 64-bit installers. Otherwise, y'all tin can be limited to the amount of information that tin can be stored within MongoDB.
It is advisable to always utilize the stable release for product environments.
In this tutorial, y'all will learn –
- Download & Install MongoDB on Windows
- Hullo Globe MongoDB: JavaScript Driver
- Install Python Commuter
- Install Ruby Driver
- Install MongoDB Compass- MongoDB Management Tool
- MongoDB Configuration, Import and Export
- Configuring MongoDB server with configuration file
- How to Install MongoDB on Cloud (AWS, Google, Azure)
How to Download & Install MongoDB on Windows
The following steps can be used to download and install MongoDB on Windows x
Footstep 1) Download MongoDB Community Server
Get to link and Download MongoDB Community Server. We will install the 64-chip version for Windows.
Stride 2) Click on Setup
Once download is consummate open the msi file. Click Adjacent in the start up screen
Step three) Accept the End-User License Agreement
- Accept the End-User License Agreement
- Click Side by side
Step 4) Click on the "complete" button
Click on the "complete" button to install all of the components. The custom option can be used to install selective components or if yous want to change the location of the installation.
Pace 5) Service Configuration
- Select "Run service as Network Service user". brand a notation of the data directory, we'll demand this later.
- Click Next
Step 6) Start installation process
Click on the Install button to start the installation.
Step 7) Click Next once completed
Installation begins. Click Adjacent once completed
Step eight) Click on the Terminate button
Concluding stride, Once complete the installation, Click on the Finish button
Hello World MongoDB: JavaScript Driver
Drivers in MongoDB are used for connectivity between client applications and the database. For example, if you lot had Java programme and required it to connect to MongoDB then you would require to download and integrate the Java driver so that the program can work with the MongoDB database.
The driver for JavaScript comes out of the box. The MongoDB vanquish which is used to work with MongoDB database is actually a javascript crush. To access information technology
Step 1) Go to " C:\Plan Files\MongoDB\Server\four.0\bin" and double click on mongo.exe. Alternatively, you can also click on the MongoDB desktop item
Footstep two) Enter post-obit program into shell
var myMessage='Hello Globe'; printjson(myMessage);
Code Explanation:
- We are just declaring a simple Javascript variable to shop a cord called 'Hi World.'
- We are using the printjson method to impress the variable to the screen.
Install Python Driver
Step 1) Ensure Python is installed on the organization
Step 2) Install the mongo related drivers by issuing the below control
pip install pymongo
Install Ruby Driver
Stride 1) Ensure Blood-red is installed on the organization
Step two) Ensure gems is updated past issuing the control
gem update -organization
Step 3) Install the mongo related drivers by issuing the beneath command
gem install mong
Install MongoDB Compass- MongoDB Direction Tool
At that place are tools in the market which are available for managing MongoDB. One such non-commercial tool is MongoDB Compass.
Some of the features of Compass are given below:
- Total power of the Mongoshell
- Multiple shells
- Multiple results
Step one) Go to link and click download
Stride two) Enter details in the popup and click submit
Step 3) Double click on the downloaded file
Step 4) Installation volition auto-get-go
Stride 5) Compass will launch with a Welcome screen
Stride vi) Keep the privacy settings as default and Click "Start Using Compass"
Stride vii) You will see homescreen with list of current databases.
MongoDB Configuration, Import, and Consign
Earlier starting the MongoDB server, the commencement key attribute is to configure the data directory where all the MongoDB data volition be stored. This can be done in the following way
The to a higher place command 'physician \data\db' makes a directory chosen \information\db in your current location.
MongoDB volition automatically create the databases in this location, because this is the default location for MongoDB to store its information. We are just ensuring the directory is present, so that MongoDB tin notice information technology when it starts.
The import of data into MongoDB is done using the "mongoimport" command. The following example shows how this tin be washed.
Pace one) Create a CSV file called information.csv and put the following data in it
Employeeid,EmployeeName
- Guru99
- Mohan
- Smith
So in the above example, we are assuming we want to import 3 documents into a collection called data. The get-go row is called the header line which will become the Field names of the collection.
Footstep 2) Outcome the mongo import control
Code Explanation:
- Nosotros are specifying the db choice to say which database the data should be imported to
- The type option is to specify that we are importing a csv file
- Retrieve that the get-go row is called the header line which will become the Field names of the collection, that is why we specify the –headerline option. And then we specify our data.csv file.
Output
The output clearly shows that iii documents were imported into MongoDB.
Exporting MongoDB is done by using the mongoexport command
Code Explanation:
- We are specifying the db choice to say which database the data should be exported from.
- We are specifying the drove selection to say which collection to apply
- The third pick is to specify that we want to export to a csv file
- The fourth is to specify which fields of the collection should be exported.
- The –out choice specifies the proper noun of the csv file to export the information to.
Output
The output clearly shows that 3 records were exported from MongoDB.
Configuring MongoDB server with configuration file
One can configure the mongod server instance to startup with a configuration file. The configuration file contains settings that are equivalent to the mongod command-line options.
For case, supposed you wanted MongoDB to store all its logging data to a custom location then follow the beneath steps
Step 1) Create a file called, "mongod.conf" and shop the below information in the file
- The start line of the file specifies that we want to add configuration for the organisation log file, that is where the information about what the server is doing in a custom log file.
- The 2d option is to mention that the location will exist a file.
- This mentions the location of the log file
- The logAppend: "true" means to ensure that the log information keeps on getting added to the log file. If you lot put the value as "imitation", then the file would be deleted and created fresh whenever the server starts again.
Step 2) Showtime the mongod server process and specify the above created configuration file as a parameter. The screenshot of how this can be washed is shown below
Once the in a higher place control is executed, the server process volition starting time using this configuration file, and if you get to the /etc. directory on your system, you volition run into the mongod.log file created.
The below snapshot shows an example of what a log file would wait like.
How to Install MongoDB on Deject (AWS, Google, Azure)
You lot do not demand install the MongoDB server and configure it. Yous can deploy MongoDB Atlas server on the cloud on platforms like AWS, Google Cloud, Azure and connect to the case using a customer. Below are the detailed steps
Stride 1) Get to the link
- Enter Personal Details
- Concord to terms
- Click button "Get Started Free"
Step 2) Click "Build my first cluster"
Footstep 3) You can select between AWS, Google Cloud, Azure as your cloud provider. In this tutorial, we will employ AWS which set be default. Make no other changes on the page and click "Create Cluster."
Footstep 4) Cluster creation takes some time:
Step 5) After some time y'all will run into
Step 6) Click Security > Add together new user
Step 7) In next screen,
- Enter user credentials
- Assign privileges
- Click Add User button
Stride 8) In the dashboard, click connect button
- Whitelist your IP connection
- Cull the connection method
Pace 9) Select the connexion method of your selection to connect to MongoDB server
Source: https://www.guru99.com/installation-configuration-mongodb.html
Posted by: mcconnellusithed.blogspot.com
0 Response to "How To Install Mongodb In Windows 10"
Post a Comment