MongoDB first met _mongodb

Source: Internet
Author: User
Tags bulk insert mongodb

These days to learn a bit mongodb, now take a note.

1. First Installation

(preferably installed in the root directory, and then manually build a DB folder)

Installation is complete because MongoDB is required to start manually, locate the Bin folder in the installation directory, hold down SHIFT, right-click, open the command line here, and enter Mongod--dbpath=f:\mongodb\db

The following is the path of your own folder.

After the completion of the Web page input http://localhost:27017 will appear as the following screen is successful connection.

This cmd is to be kept open, and if it is turned off, you have to re-enter the command to start.

2, open a new cmd, input MONGO, you can enter the command, the data operation. In fact, MongoDB and other databases are similar, the name is not the same, some statements are not the same, is not relational. (Just own understanding)

2.1, use test if the database does not have this test, that is, create and point to this database, if so, point to this database, if you want to show test, you must add the database to the test database

2.2, show DBS display collection,

2.3. Inserts the document Insert () Save ()


The above two methods can only be inserted, if you want to bulk INSERT, you can write the function in the command line for the loop, that is, to achieve BULK insert


2.4 Delete document Remove ()


Db.test.remove ({}) can delete all documents

2.5 Query documents Find (), FindOne ()

and conditional queries, or condition queries, and and and or can be used in conjunction

2.6 Pretty () to display all documents in a formatted manner



Well, it's over, I really don't want to write because I'm the front end. Hum, please ask the wrong.

You can learn on the rookie tutorial, which is more detailed.

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.