MongoDB Download and Installation

Source: Internet
Author: User
Tags mongodb download

The previous period was learning MONGOLIADB database. Wrote the operation of the document, here to share to everyone. This is the download and installation of MongoDB database,

I'll also write an article about his basic additions and deletions in Java

Preface. Comparison of MongoDB and relational databases


1.MongoDB Downloads

When downloading, select the number of digits corresponding to your operating system, such as

Available on MongoDB 's official download:http://www.mongodb.org/

You can also go to Baidu third-party website download:

Http://www.veryhuo.com/down/html/mongodb.html

2.MongoDB Installation

1. unzip the downloaded compressed package

2. Create two new folders: for example, built on the E - disk MongoDB and mongodbdata ( database file )

3. copy the extracted files to the MongoDB folder; As my:E:\MongoDB

4. This step begins to be more important, run with the cmd command:

In the command description: Find the E - disk under the bin of MongoDB under the mongod command and execute, put the database that MongoDB created is placed in the mongodbdata file

3. Configure environment variables and tests

1. The MongoDB database is configured with the same environment variables as the JDK:

Open My Computer Properties--Advanced system settings--environment variables--Find Path and click Edit-- add a semicolon to the last side to separate the bin under MongoDB The path is copied to the last instance ; E:\MongoDB\bin

2. We can test if the installation is successful:

cmd command, enter mongod-help carriage return, the following MongoDB command keys and corresponding descriptions appear

3. For later convenience, we set up two shortcuts . bat format. Can be built on the desktop:

1. Create a new text document and change the extension to . bat

2. Right-click mongodb.batand edit to enter the following:mongod--dbpath E:\MongoDBDATA

3. Right-click mongodb27017.bat, edit input:MONGO 127.0.0.1:27017/admin

4. For example, you can run the MongoDB data with the DOS command mongodb.bat ( cannot be closed ), and then run mongodb27017.bat(command operations for the database can be performed in this command)

Some simple command operations for 4.MongoDB databases

Run the mongodb.baton the desktop; run mongodb27017.batagain;

1. Create a database: Usefoobar

2. View all databases:Show DBS

3. Add a persons table and name property:Db.persons.insert ({name:"QHS"},{password: " 123456 "})

Description: The commands are all db. Table name . Statement ({}) There are: The number is to be used {} up and then have, the number is separated

4. Modify the properties in the persons table:db.persons.update ({name:"QHS"},{$set: {name: "QQQ"}})

Description: The first {} in the curly braces is a query condition; The following $set is the modifier,{} is the content to be modified

5. Query The contents of the persons table:db.persons.find ()

6. Query The first data in the persons table (the table has a lot of data):db.persons.findOne ()

7. Delete persons table:db.persons.remove ({name:"QQQ"})

Delete to add query criteria

8. Delete the collection of databases:db. Table name . Drop ()

9. Delete database:db.dropdatabase ()

Help documentation for the Shell:db.help () or db. Table name . Help ()

.......... There are also many commands that can be viewed in the appropriate Help document for command operation

5. Install Installer.msi graphical interface

Most of the database will be more or less the corresponding graphical interface operation, of course, MongoDB Also,Installer is a mongodb Graphical interface operation software, very simple installation: Always Next can be

6. Login MongoVUE.exe

Run the MongoVUE.exe that we installed earlier; jump out of the options box and select the + sign (add a database). Jump out of the dialog box,Server is native 127.0.0.1. Port is MongoDB , database is name

If the port is wrong, or the service is not Open, click Test, you can testing the connection, the first one for failure, the second for success!


7.MongoVUE Interface Introduction

After filling in the contents of the landing, click Save Login, double-click the box to log in the database, into the user interface:

The left side of the interface is a database paging category, and to the right is a view that can be selected by a self-favorite:

Tree view : As a treeview,

Table View: For tabular views, like the graphical interface of other databases,

Text view: for the textual views.

Although I used this interface for the first time, I still like the first tree view:

You can right-click on the table, insert key to add keys and values, you can delete with remove , you can jump to the query in Send to, modify, Delete a separate interface for Operation

8. A simple example of a modification operation

Example: For example, I want to modify a property value in a table. As that, then select Update View from the Send to drop-down menu

Interface Description: The left is the modified condition, just like the where statement in MYSQL ; Right is the key value to be modified.

Let's change the name value of this ID , which is qhs, we modified it to QQQ

Right a simple modification code then click Update 1 to modify 1 . Has finished modifying the interface,

This action is equivalent to the DOS Command window:

> db.persons.update ({name: "QHS"},{$set: {name: "QQQ"}})


Let's take a look at the modified result: the modified name is qhs; now QQQ

9. Set up service auto-start service

1. Create the following file in the MongoDB folder:mongodb\data\log

2. Run cmd into the DOS window

3. Execute the statement:

E:\mongodb\bin>mongod--dbpath "E:\MongoDBDATA"--logpath "E:\MongoDB\data\log\MongoDB.log"--install-- ServiceName "MongoDB"

Here MongoDB.log is the log file that was started,--servicename the "MongoDB" service named MongoDB


You can use commands to switch services:

>net start MongoDB ( Open service)

>net Stop MongoDB ( shutdown service )

can also be in: Control Panel--management tool--services found in the MongoDB service to set up the account status!

MongoDB Download and Installation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.