Getting started with [MongoDB]

Source: Internet
Author: User

Summary

In the work also often use MongoDB, each encounter new operations need to check, more trouble, ready to blog in the system to learn MongoDB. First install the MONGODB environment locally, you can download a version of Windows.

Official address

Installation

I am using the default installation, which uses the MongoDB x64 version, where the installation directory is C:\Program files\mongodb\server\3.2

MongoDB defaults to storing data in the created folder data/db of the root directory of the installed disk, using the command installation discovery and cannot create the data folder, so you can create the file manually.

Win+r Open the command-line console.

Go to the MongoDB Bin directory and run the command Mongod

can be accessed via http://localhost:27017/

Look at the contents of the Data/db folder again and you will find a lot of things.

Start a cmd.exe input command MONGO

You can see the MongoDB version number from the above, and the database with the default action is test.

Test, a new collection,mongodb named user will determine whether the user collection exists and does not exist. It is important to note that a document form in collection is JSON, but in MongoDB it has an additional name Bson, which can be understood as an extension of JSON.

Insert

Find

Tip: _id is a GUID that can be understood as the primary key ID, uniquely identifying the bar data.

Find (where)

Tip: Find parameters that can receive the Bson format.

Update (WHERE,NEW)

Tip: The update operation, the first parameter is the find condition, and the second is the value to update.

Locate the data according to _ID, and then modify the user's gender to be female.

Remove (where)

Remove the user whose name is Wolfy.

Summarize

Here is a brief introduction to the installation of MongoDB on Windows, as well as some common additions and deletions to check the operation.

Getting started with [MongoDB]

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.