How do I learn MongoDB thoroughly

In the past few years, noSQL has arguably been the most popular database industry, and Oracle has started looking into it. I don't know much about non-relational databases so it is better to learn mongoDB. Taking regular notes is also a very good habit to learn.

The installation of database software. In fact, MongoDB (Windows version) is green. This is a very good thing. Don't wait long to get it installed. On the official website ( you can download it and then extract it to the local level. Here I unzip it to E: \ MongoDB.

The data file path. Like all databases, data must be stored in a dedicated data storage directory (there are more folders in Windows). You can see a lot of executable files in the bin directory. Among other things, mongod.exe is used to set the path. The command is very simple. Here E: \ MongoDB \ db is used as the path. The command can then be written as follows: E: \ MongoDB \ bin> mongod.exe --dbpath = E: \ MongoDB \ db. Then you will see a lot of prompts as shown in the picture, but they basically don't need to be shown:

The documents are as follows:

3 Get started. After the data file path is set, you can use it. The executable file is mongo.exe. This brings up the command prompt interface, as simple as Oracle under sqlplus. As shown below:

4 Basic database operations. The most basic operation in the database is nothing more than adding, deleting, changing, and checking. Whichever database is used, if these four features are not available, it will be a database with disabilities. I haven't seen the concept of tables in Mongo, but what does almost the same thing is collection. For example, in the above illustration there are two collections under the test library. Below these, foo contains the data that I inserted earlier. Now check one: (). Will appear:


To my current understanding, the database entry is very similar to the XML key value, Name is the key and "Tom" is the key value, Age is the key, and "30" is the key value. A collection is not like a table. Whether or not you have a related gender record, Tom must have the Gender column. In contrast to a table, the age column must be of the same data type. Otherwise, a type conversion is carried out automatically when you insert it again. . Here Tom has no records of sex, there are none, Jerry's age is recorded here as a numeric type, and Tom's age is a character type, which means that a collection is a collection of information, but not all records are fully formed and freely exist .

There is less gossip, the following is increased: ({"Name": "Obama", "Age": "50", "Gender": "male", "Job": "President"}) ;

I accidentally spelled the wrong line in the middle, sorry. It can be seen that adding records is really a bit of a hassle because you don't have to put the keys into fixed-form tables each time, but instead have to write each time followed by the key value.

The following is the change: ({"name": "Obama"}, {"nation": "USA"});

It can be seen that the change was thorough.

Deletion process: ({"nation": "UDA"}):

The dangerous part of this database is that the add, delete, and modify operations don't even need to be committed. It's gone. Perhaps I will be exposed to relevant content in my future studies. Take your time and learn.

There are many more powerful features waiting for me to explore. I hope people reading my blog post will like noSQL and Mongo.

The command line tool in the illustration above is PowerCMD, an extension of the Windows command line tool. It is very easy to use. It is recommended for everyone to use it.

It's free and can be found on Baidu Search.