What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

Time:2022-5-17

Hello! Hello, I’m Xiao Qi, a programmer who loves sharing
Xiaoqi plans to share some techniques in a relaxed and humorous way. If you think you have learned something from Xiaoqi’s article, give Xiaoqi a compliment
The article is continuously updated. You can search [Xiaoqi Java interview] on wechat, read it for the first time, reply to [data], and I have prepared benefits for you! Reply [PROJECT] there are some project source codes I prepared for you.

1、 Foreword

Last time, I decided not to go to sister Qiu’s company because she had children. Although she hated me very much, I had to go. Although I was scum, I was still a little moral…

So I decided to go back to my hometown first. After all, I don’t have enough money to float down in Beijing.

I made several more trips to the subway, then got on the bus back to my hometown, and watched the window change from a high-rise building to a dilapidated bungalow, just like my mood from a passionate teenager to aMelancholy Prince。。。

Finally arrived in the town of my hometown. The air in my hometown felt comfortable. I stopped a three wheel car and prepared to go back to the village. I can’t use the advertisements on these three wheels…

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

After 20 minutes of three rounds, we finally arrivedTalent VillageAt the door, I saw a row of people sitting at the entrance of the village from a distance. I expected that there would be another good play in the village. I hurried to inquire.

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

Me: “how many grannies are resting”.

Grandma Zhang: “Oh, Xiaoqi is back. You can really pick the time. It’s just in time to watch the excitement.”.

Me: “what’s the excitement?”.

Grandma Wang: “it’s Aunt Liu, her child’s dog egg. She skipped school and went to the Internet cafe. She was caught by the teacher. Her mother is beating her.”.

Me: “Hey, what a big deal I should be, isn’t it to go to the Internet cafe? Just advise.”.

Grandma Liu: “we can’t persuade you. Xiao Qi, you have a good relationship with Aunt Liu. Go and persuade.”.

Me: “well, I’ll go, I’ll go.”.

When I walked over, I found that the dog egg was blocked at the door by Aunt Liu. Aunt Liu was teaching the dog egg a lesson by holding the clothes handed down by their family for 20 years…

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

Me: “Oh, Aunt Liu, I’ve heard all about it. Why don’t you go to an Internet cafe? Who didn’t go to an Internet cafe when he was a child? Just say that the child knows he’s wrong.”.

Aunt Liu: “the child failed every exam for me. It’s useless for me to educate. It seems that I can only play.”.

Me: “that must be your wrong way of education. Dog egg, tell little Chico how your mother usually educates you.”.

Dog egg: “my mother said we should study hard, or we will be unable to find a job and marry a daughter-in-law like brother Xiaoqi when we grow up.”.

(my special…)

Aunt Liu: “Oh, Xiao Qi, don’t be angry. It’s mainly because you can take others as examples. Others can mix well. If you take you as an example, you’re afraid, because you’re really miserable…”

“I have to go home,” I said.

Aunt Liu: “don’t be angry, Xiao Qi. I’m still waiting to hear your gossip. Do you have any new gossip?”.

Me: “I’ll tell you when I’m in a good mood. I’m leaving.”.

When I opened the old wooden door of my home and saw the weeds in the yard, I felt very unhappy. When I entered the house and lay in bed, I recalled what dog egg said just now. I really didn’t find a job, let alone where my daughter-in-law was, and sadness suddenly came to my heart…

Suddenly the cell phone rang and I answered the phone.

Me: “hello”.

Opposite: “Hello, is this Xiao Qi?”.

Me: “it’s me, you are?”.

Opposite: “I’m from XXX company. I see your resume pushed by HR. I feel pretty good. When is it convenient for you to come for an on-site interview?”.

Me: “it’s not convenient for the on-site interview now. I’ve just returned to my hometown, unless you reimburse me for my return fee and one day’s delay fee”.

Opposite: “don’t you have a job now? Why do you still have a delay fee?”.

Me: “I hoe weeds in the yard at home. If I ask someone to do it for a day, I’ll have to pay 50 yuan.”.

Opposite: “well, is it convenient for you now? Let’s have an online interview now.”.

Me: “OK”.

2、 Interview

Interviewer: “I think your resume says you are proficient in mongodb. Is it true?”.

Me: “OK, it’s all flattered by the interviewers, which makes me swell up.”.

Interviewer: “then you can simply say what mongodb is.”.

Me: “mongodb is a database based on distributed file storageNon relationalDatabase for.

Interviewer: “what are the advantages of non relational databases?”.

1. Non relational databases store data in the form of key and value, which is more in line with the thinking mode of programmers. There is no fixed data type.
2. Non relational databases are based on memory storage, which is faster than relational databases.

3、 The difference between relational database and non relational database

Interviewer: “what’s the conceptual difference between non relational database and relational database?”.

Me: “in our commonly used relational databases, we know that there are tables in a database, there are multiple columns in each table, and then there are associations between tables”.

I: “in Philippine relational database, there is no concept of table, but the concept of set, that is, there are multiple sets in a database, and then the concept of no column in the set is the concept of field, and the relationship between sets is expressed by putting the data in one set into another set”.

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

4、 Mongodb installation

Interviewer: “tell me about the installation process of mongodb and the basic syntax.”.

1. Download

Mongodb download address:https://www.mongodb.com/try/d…

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

2. Installation

Double click to open the installation package, and then next

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

Accept the agreement and go to the next step

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

Install full version

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

Select the path of data storage and log storage

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

Next, uncheck the default visualization tool here

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

install

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

Complete installation

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

3. Configure environment variables

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

Check whether mongodb is installed successfully. Open the CMD command window and enter mongod to prove that the mongodb service is started successfully.

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

Connect mongodb and enter the command Mongo. This proves that the connection is successful.

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

4. Graphical interface mongodbmanager download address:https://www.mongodbmanager.co…

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

5、 Basic syntax of mongodb

1. Insert syntax dB [set name] Insert ({data to insert});

db.stus.insert({name:”zhubajie”,age:28});

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

2. Query syntax dB [set name] find();

db.stus.find();

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

3. Modify syntax dB [set name] update();

db.stus.update(

{"_id" : ObjectId("627fd8c54394fde2bb137b80")},
{$set:{
    name:"sunwukong",
    age:30
}
}

)

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

4. Delete syntax dB [set name] remove();

What is mongodb? What are the advantages of non relational databases? Installation and use tutorial

Interviewer: “nice guy. When can I return to Beijing?”

Me: “er… Wait, the epidemic in Beijing is too serious now.”

Interviewer: “OK, you must come to our company when you come to Beijing.”

Me: “er… I can’t promise you this. What if there are other good companies to call me?”.

Interviewer: “come on, the terms are easy to discuss”

Me: “I’ll think about it.”.

6、 Summary

Mongodb has not been sorted out here. It is continuously updated at the end of the article. It is recommended to collect it.

The commands involved in the article must be typed several times like me. Only in the process of typing can you find out whether you really master the commands.

If you think my article is good, please praise it. In addition, you can search [Xiaoqi Java interview] on wechat to read more good articles and obtain the materials I prepared for you. Reply to [PROJECT] more open source projects are continuously updated and shared with you.