Basic MongoDB learning-environment building and usage skills, mongodb --

Source: Internet
Author: User

Basic MongoDB learning-environment building and usage skills, mongodb --
Summary

Relational databases are the most commonly used, and NoSQL is not very familiar with it. However, for the current development, NoSQL is also a very popular direction, and among the many NoSQL databases, MongoDB is so "beautiful" that you can not help but be fascinated. However, what I did not expect was that the process was so bumpy. As a result, this article is recorded.

Environment build prelude

As usual on the official website https://www.mongodb.com/directly find the download button, download a windows. msi version of just fine.

The latest official version of mongodb requires:
Support for VC ++ 2015 RC x64; otherwise, an error is reported.

However, unfortunately, my computer version is not enough. What is the situation?
Then I checked the document. For Windows 7, the minimum version is 7601, and my version is 7600. (⊙ o ⊙! It's really cool.

The following window is displayed during installation:

Missing api-ms-win-crt-runtime-| 1-1-0.dll

Now that you know where the problem comes from, the goal is very clear, and you can find and find it online. There are many answers, but they are basically unreliable. I failed to succeed.

Finally, upgrade Windows and add a patch package. However, the network speed is not good. After a long time, it will eventually fail.

Future moves

Since downloading the latest version doesn't work, let's go back to the next step. Download the earlier version. It should be enough to learn how to use and not use any complicated functions.

I tried version 2.0.6, which is easy to use. For more people to learn how to use it, you can download it at the following link.

Download and decompress the package to a folder.

I am not sure that this version can be used.

Configuration

As shown in step 2, extract the downloaded package to a folder. Create a folder to store the database data (this folder is placed at will, but it is better to put it together for convenient management ).

Configure Environment Variables

To enable the command line to find some built-in commands of mongodb, We need to configure the bin directory to the environment variables of our computer.

Computer-system properties-advanced system settings-Environment Variable-path

Configure data path

To help MongoDB locate the data location, we need to configure it slightly. Used to temporarily enable the mongodb database service. If you are interested, you can also turn it into a system service, which is more convenient to use. Here we will not go into more details.

Mongod-dbpath "data folder path"

When the new version of mongodb is opened with MongoVUE, collections is not displayed. This is because of the engine.
You can use this command to start the mongodb service.

Mongod.exe-storageEngine mmapv1-dbpath D: \ Software \ mongodb \ db

Note that the db path at this time should be the new database folder path. The reason is that the mmapv1 engine is not the same as the wiredTiger engine.

The following information indicates that the database path is successfully configured.

View information

To enable the mysterious veil of mongodb more clearly, you can view details in a browser.

Mongo 127.0.0.1: 27017/admin

Follow the prompts and try the following:

Mongo 127.0.0.1: 28017/admin

Initial use

For MongoDB, Shell should be used at the beginning, which can lay a more solid foundation for the future. Most of the following will be done in comparison with the relational database MySQL to further enhance understanding and use of NoSQL.

Login

Similar to MySQL terminal Logon:

Mysql-u root-p password

Mongodb is similar, as follows:

Mongo 127.0.0.1: 27017 admin

It indicates that you have successfully logged on. (No password by default ).

Display database information

Similar to MySQL, you can view the database information in the system.

Show databases;
Mongodb is similar, but the command names are different.
Show dbs;

For example:

Select Database

In MySQL, to use a specified database, you can use:

Use DatabaseName;

In MongoDB, the same is true:

Use foobar

For example:

Display table/Document Information

In a relational database, you can view tables in a database:

Show tables;

In non-relational databases such as MongoDB, the principle is similar. However, the concept is slightly different. For example, NoSQL calls a table a collection ). The command for displaying documents in mongodb is:

Show collections;
For example:

Add, delete, modify, and query

Unlike a relational database such as MySQL, the addition, deletion, modification, and query commands in NoSQL have specific usage methods. It is also implemented based on "conditions", which has nothing to do with SQL statements.

Find () remove () update () insert ()

As for the details, I will skip this section for the time being. The following blog may detail the details.

Client

Familiar with Shell operations on mongodb, and familiar with command writing. At this time, you can use the client tool to help us further improve efficiency. Find an article on the Internet for MongoDB clients.
Https://blog.csdn.net/chszs/article/details/51348248

What I want to talk about here is a useful client tool. MongoVUE. Here, we will mainly explain how to crack this tool, so as not to hate the pop-up window in the future.

Download, install, and crack the path

First, press Win + R to call up the CMD command line and enter regedit. Find the fields shown in the following figure and delete the 1, 2, 3 on the right. (The hacker has cracked the attack beforehand, so he borrowed the hacker's cracking diagram ).

In this way, you can use this artifact for free.

Summary

This article roughly talks about some basic things of NoSQL's leading MongoDB. There is no skill in building an environment. Solved some strange problems.

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.