MongoDB MongoDB is it you have to know what the hell MongoDB - 1 of MongoDB MongoDB is you have to know what the hell MongoDB - 1

MongoDB MongoDB is it you have to know what the hell MongoDB - 1

 

Recently there are too many students told me about MongoDB, you want to learn MongoDB, MongoDB in the end do not know what the hell, or that know a database, document database know, but I do not know how to use

So good, so-called long-awaited, and now I will pull it to you:

A. What had to start with the theory of acquaintance MongoDB start, you is not ah?

MongoDB is a distributed file storage based database. Written by C ++ language. Designed to provide scalable, high-performance data storage solution for WEB applications.

MongoDB is a product with function between relational databases and non-relational databases, non-relational database functions among the richest and most like a relational database.

The official explanation given above, then the summary, Madrid FUCK! Valid information too little (completely useless)

So let me say something about MongoDB use human language it

It relational database that we use the biggest difference is binding, it can be said almost non-existent file database binding, in theory, no primary foreign key constraint, there is no type of data stored constraints, etc.

Relational database concept of a "table", the concept of "field", the "data entry" concept

MongoDB also have more in concept, but the name has changed, strictly speaking, is the concept of two similar, but slightly different, but it does not matter, when we are more than concepts thousand million

Light said, still a bit fuzzy, let's do a small example, we carried out a comparative

Let's make a list:

This is what we use relational databases do a very simple User table right

Next we look at the data structure of MongoDB:

What does this ...... This is a special list, which stood three dictionary? You're right, if you understand became the lists and dictionaries, then you will only prove Python, it in other languages is another type, and we call this type of thing, is called: Json

Then you should suddenly realize it, each data MongoDB each table (Collection) stored (Documents) is a one Json, Json each field (Key) we call: Field

This leads us three keywords, Collection is the concept of relational database "table", Documents is the "data entry", Field is the "field"

 

Two .MongoDB of installation you have to install the database in order to continue the deployment of equipment X

About Installing MongoDB, really is not difficult, really, really is not difficult to follow step by step DragonFire operate with you Legendary

First of all give you a share of MongoDB 3.4 msi installation package Click here to download oh (if you can not prove I did not get to share download msi, download it yourself)

 

After the installation is complete, began to enter the configuration link, we need to go to the directory:

"C:\Program Files\MongoDB\Server\3.4\bin"

Take your configuration environment variable, so that X installed more natural and the United States:

After the operation, windows 7 and windows 10 are not the same, much the same friends

windows 10 all the way in the end "OK"

windows 7 Note that here, Path path to move to the last, enter: "; C: \ Program Files \ MongoDB \ Server \ 3.4 \ bin" must bring ";" Oh,

Because there is no windows 7 operating system of the computer to find, so here only to windows 7 students say sorry

OK! To here we have completed the basic part of the operation of the

Let's try it the results

Open a cmd window ZB action bar

Then we create a "C: \ data \ db \" directory now

Okay directory already, try again ZB

Well, the success of the open

Then the service is turned on, and how client connect to it, then we need another cmd window open mongo client

到此,我们成功的完成了,服务端的部署开启,还有客户端的链接,如果你还想继续往下学习的话,我给你一句金玉良言

 

千万别把这两个cmd窗口关了,不然你还得重新打开一次,哈哈哈哈哈哈哈哈!!!!

 
 

最近有太多的同学向我提起MongoDB,想要学习MongoDB,还不知道MongoDB到底是什么鬼,或者说,知道是数据库,知道是文件型数据库,但是不知道怎么来用

那么好,所谓千呼万唤始出来,现在我就拉给你们看:

一.初识MongoDB 之 什么东西都得先从理论入手,你说是不是啊?

MongoDB 是一个基于分布式文件存储的数据库。由 C++ 语言编写。旨在为 WEB 应用提供可扩展的高性能数据存储解决方案。

MongoDB 是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的。

官方给出了以上的解释,那么综上所述,马德 F U C K ! 有效信息太少了(完全没用)

那么让我来用人类的语言讲述一下MongoDB吧

它和我们使用的关系型数据库最大的区别就是约束性,可以说文件型数据库几乎不存在约束性,理论上没有主外键约束,没有存储的数据类型约束等等

关系型数据库中有一个 "表" 的概念,有 "字段" 的概念,有 "数据条目" 的概念

MongoDB中也同样有以上的概念,但是名称发生了一些变化,严格意义上来说,两者的概念即为相似,但又有些出入,不过无所谓,我们就当是以上概念就好啦

光说的话,还是有点儿模糊,就让我们来做一个小例子,进行一个对比吧

下面我们做一张表:

这是我们用关系型数据库做的一张很简单的User表对吧

接下来我们再看一下MongoDB的数据结构:

这......这特么不就是个列表,里面放着三个字典吗?你说的对,如果你理解成了列表和字典,那么证明了你只会Python,在其他语言中它又是别的类型了,我们把这种类型的玩意儿,叫做:Json

那么你就该恍然大悟了吧,MongoDB的每个表(Collection)中存储的每条数据(Documents)都是一个一个的Json,Json中的每一个字段(Key)我们称之为:Field

就此我们引出了三个关键字,Collection也就是关系型数据库中"表"的概念,Documents就是"数据条目",Field就是"字段"

 

二.MongoDB安装部署 之 你必须得先安装上数据库才能继续装X

关于MongoDB的安装,真的没有难度,真的真的没有难度,来跟着DragonFire一步一步操作,带你Legendary

首先分享给你一个MongoDB 3.4的msi安装包 点击这里可以下载哦(如果不能下载证明我还没搞定分享msi,自己下载一个吧)

 

安装完成之后,开始进入配置环节,首先我们要进入目录:

"C:\Program Files\MongoDB\Server\3.4\bin"

带着你配置环境变量,让X装的更加自然更加美:

之后的操作,windows 7 与 windows 10 不太一样,大同小异啦

windows 10 一路到底的"确定"

windows 7 在这里需要注意的是,Path路径移动到最后,输入:"  ;C:\Program Files\MongoDB\Server\3.4\bin  " 一定要带上 "  ;  " 哦

因为没有找到windows 7 操作系统的计算机,所以这里只能给windows 7 的同学说声抱歉了

OK!到了这里我们基本已经完成了部分操作了

我们来试一下成果吧

打开cmd窗口进行一次ZB的操作吧

那我们来创建一个" C:\data\db\ "的目录吧

好了目录已经有了,再次ZB试一下

好了开启成功了

那么服务开启了,客户端怎么去连接呢,这时我们需要另一个cmd窗口开启mongo的客户端

到此,我们成功的完成了,服务端的部署开启,还有客户端的链接,如果你还想继续往下学习的话,我给你一句金玉良言

 

千万别把这两个cmd窗口关了,不然你还得重新打开一次,哈哈哈哈哈哈哈哈!!!!

Guess you like

Origin www.cnblogs.com/itzhangxuhui/p/11263124.html