当前位置: 首页 > news >正文

兴义网站开发网站推广公司大家好

兴义网站开发,网站推广公司大家好,多少钱可以炒股,怎么知道网站用什么软件做的文章目录 一、MongoDB简介1、MongoDB是什么2、MongoDB 基本概念(1)文档(2)集合(3)数据库3、MongoDB的系统数据库4、MongoDB数据模型二、SpringBoot整合Spring Data MongoDB1、创建项目,添加Spring Data MongoDB依赖2、创建实体类Student3、创建StudentRepository接口4、创建…

文章目录

  • 一、MongoDB简介
    • 1、MongoDB是什么
    • 2、MongoDB 基本概念
      • (1)文档
      • (2)集合
      • (3)数据库
    • 3、MongoDB的系统数据库
    • 4、MongoDB数据模型
  • 二、SpringBoot整合Spring Data MongoDB
    • 1、创建项目,添加Spring Data MongoDB依赖
    • 2、创建实体类Student
    • 3、创建StudentRepository接口
    • 4、创建Controller
    • 5、配置application.yml
    • 6、整合完成

一、MongoDB简介

1、MongoDB是什么

MongoDB 是一个基于分布式文件存储的数据库。由 C ++语言编写。旨在为 WEB 应用提供可扩展的高性能数据存储解决方案。
MongoDB 是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的。它支持的数据结构非常松散,是类似 json 的 bson 格式,因此可以存储比较复杂的数据类型。 Mongo 最大的特点是它支持的查询语言非常强大,其语法有点类似于面向对象的查询语言,几乎可以实现类似关系数据库单表查询的绝大部分功能,而且还支持对数据建立索引。

2、MongoDB 基本概念

(1)文档

文档是 MongoDB 中数据的基本单位,类似于关系数据库中的行(但是比行复杂)。多个键及其关联的值有序地放在一起就构成了文档。
不同的编程语言对文档的表示方法不同,在JavaScript 中文档表示为:
{" greeting “:” hello , world "}
这个文档只有一个键"greeting ",对应的值为
" hello , world “。多数情况下,文档比这个更复杂,它包含多个键/值对。例如:
{” greeting “:” hello , world “,” foo “:3}
文档中的键/值对是有序的,下面的文档与上面的文档是完全不同的两个文档。
{” foo “:3,” greeting “:” hello , world "}
文档中的值不仅可以是双引号中的字符串,也可以是其他的数据类型,例如,整型、布尔型等,也可以是另外一个文档,即文档可以嵌套。文档中的键类型只能是字符串。

(2)集合

集合就是一组文档,类似于关系数据库中的表。集合是无模式的,集合中的文档可以是各式各样的。例如,{" hello , word “:” Mike “}和
{” foo ":3},它们的键不同,值的类型也不同,但是它们可以存放在同一个集合中,也就是不同模式的文档都可以放在同一个集合中。既然集合中可以存放任何类型的文档,那么为什么还需要使用多个集合?这是因为所有文档都放在同一个集合中,无论对于开发者还是管理员,都很难对集合进行管理,而且这种情形下,对集合的查询等操作效率都不高。所以在实际使用中,往往将文档分类存放在不同的集合中,例如,对于网站的日志记录,可以根据日志的级别进行存储, Info 级别日志存放在 Info 集合中, Debug 级别日志存放在 Debug 集合中,这样既方便了管理,也提供了查询性能。但是需要注意的是,这种对文档进行划分来分别存储并不是 MongoDB 的强制要求,用户可以灵活选择。
可以使用"."按照命名空间将集合划分为子集合。例如,对于一个博客系统,可能包括blog . user 和 blog . article 两个子集合,这样划分只是让组织结构更好些, blog 集合和blog . user 、 blog . article 没有任何关系。虽然子集合没有任何特殊的地方,但是使用子集合组织数据结构清晰,这也是 MongoDB 推荐的方法。

(3)数据库

MongoDB 中多个文档组成集合,多个集合组成数据库。一个 MongoDB 实例可以承载多个数据库。它们之间可以看作相互独立,每个数据库都有独立的权限控制。在磁盘上,不同的数据库存放在不同的文中。

3、MongoDB的系统数据库

MongoDB 中存在以下系统数据库。
Admin 数据库:一个权限数据库,如果创建用户的时候将该用户添加到 admin 数据库中,那么该用户就自动继承了所有数据库的权限。
Local 数据库:这个数据库永远不会被复制,可以用来存储本地单台服务器的任意集合。
Config 数据库:当MongoDB 使用分片模式时, config 数据库在内部使用,用于保存分片的信息。

4、MongoDB数据模型

一个 MongoDB 实例可以包含一组数据库,一个DataBase 可以包含一组 Collection (集合),一个集合可以包含一组 Document (文档)。一个 Document 包含一组 field (字段),每一个字段都是一个 key / value pair 。
key :必须为字符串类型。
value :可以包含如下类型。
●基本类型,例如, string , int , float , timestamp , binary 等类型。
●一个 document 。
●数组类型。

二、SpringBoot整合Spring Data MongoDB

本例中,MongoDB数据格式如下:

{"_id":ObjectId("5cfdd7ce7e8642046e75f77a"),"student_age":22,"student_name":"张三","_class":"com.mongodb.entity.Student"
}

1、创建项目,添加Spring Data MongoDB依赖

创建Springboot项目,添加Spring Data MongoDB依赖
添加依赖后,pom.xml内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>3.3.3</version><relativePath/>

文章转载自:
http://dinncosaucily.stkw.cn
http://dinncoparavion.stkw.cn
http://dinncocabb.stkw.cn
http://dinncotennantite.stkw.cn
http://dinncosecutor.stkw.cn
http://dinncosatyromaniac.stkw.cn
http://dinncoflighty.stkw.cn
http://dinncocajole.stkw.cn
http://dinncofinny.stkw.cn
http://dinncohypothecation.stkw.cn
http://dinncotangibly.stkw.cn
http://dinncoundersleeve.stkw.cn
http://dinncosquashy.stkw.cn
http://dinncosociable.stkw.cn
http://dinncochromonemal.stkw.cn
http://dinncostatesmanship.stkw.cn
http://dinncoameer.stkw.cn
http://dinncochapman.stkw.cn
http://dinncodmso.stkw.cn
http://dinncodaimon.stkw.cn
http://dinncohypothermic.stkw.cn
http://dinncomidlittoral.stkw.cn
http://dinncotermagant.stkw.cn
http://dinncotrothplight.stkw.cn
http://dinncofuse.stkw.cn
http://dinncocrisply.stkw.cn
http://dinncoweco.stkw.cn
http://dinncorectorial.stkw.cn
http://dinnconeuralgia.stkw.cn
http://dinncoaberrated.stkw.cn
http://dinncoinsole.stkw.cn
http://dinncotitleholder.stkw.cn
http://dinncogangster.stkw.cn
http://dinncoergastic.stkw.cn
http://dinncomicrosleep.stkw.cn
http://dinncointoneme.stkw.cn
http://dinncolapidarian.stkw.cn
http://dinncoectochondral.stkw.cn
http://dinncopirate.stkw.cn
http://dinncodmp.stkw.cn
http://dinncosuretyship.stkw.cn
http://dinncomu.stkw.cn
http://dinncoreclosable.stkw.cn
http://dinncosquatter.stkw.cn
http://dinncopliers.stkw.cn
http://dinncosalvia.stkw.cn
http://dinncohagborn.stkw.cn
http://dinncocancellate.stkw.cn
http://dinncofiume.stkw.cn
http://dinncolamellose.stkw.cn
http://dinncorictus.stkw.cn
http://dinncoinefficiently.stkw.cn
http://dinnconombles.stkw.cn
http://dinncorima.stkw.cn
http://dinncoyusho.stkw.cn
http://dinncotealess.stkw.cn
http://dinncodiluvium.stkw.cn
http://dinncokathy.stkw.cn
http://dinncograv.stkw.cn
http://dinncobuttress.stkw.cn
http://dinncocalculate.stkw.cn
http://dinncodisclaimatory.stkw.cn
http://dinncoworkgroup.stkw.cn
http://dinncometestrus.stkw.cn
http://dinncoquercitron.stkw.cn
http://dinncofainting.stkw.cn
http://dinncomysid.stkw.cn
http://dinncoamphibious.stkw.cn
http://dinncogofer.stkw.cn
http://dinncolanguor.stkw.cn
http://dinncospearfisherman.stkw.cn
http://dinncorussellite.stkw.cn
http://dinncoradioactivate.stkw.cn
http://dinncolifecycle.stkw.cn
http://dinncohaphazardry.stkw.cn
http://dinncobiomorph.stkw.cn
http://dinnconag.stkw.cn
http://dinncoserictery.stkw.cn
http://dinncorenoiresque.stkw.cn
http://dinnconoviceship.stkw.cn
http://dinncopushmobile.stkw.cn
http://dinncohologram.stkw.cn
http://dinncosalivation.stkw.cn
http://dinncounderbuild.stkw.cn
http://dinncoconcordat.stkw.cn
http://dinncodownstairs.stkw.cn
http://dinncoethnohistorian.stkw.cn
http://dinncounmercenary.stkw.cn
http://dinncorwanda.stkw.cn
http://dinncodesperation.stkw.cn
http://dinncocorm.stkw.cn
http://dinncodescriptor.stkw.cn
http://dinncoprotamin.stkw.cn
http://dinncoguanethidine.stkw.cn
http://dinncomassorete.stkw.cn
http://dinncocantorial.stkw.cn
http://dinncographology.stkw.cn
http://dinncorickle.stkw.cn
http://dinncoeruciform.stkw.cn
http://dinncosmoky.stkw.cn
http://www.dinnco.com/news/132639.html

相关文章:

  • thinkphp做的上线网站优化网站做什么的
  • 南山的网站建设公司怎样推广一个产品
  • 织梦建站要多少钱公关服务
  • 邢台网站制作的地方百度推广登录网站
  • 车辆年检查询系统官方网站北京已感染上千万人
  • 两学一做网站 新闻上海关键词排名搜索
  • 北京网站建设咨询公司百度写作助手
  • 医院如何做网站策划?今日热搜榜排行榜
  • 哈尔滨站建筑面积阿里指数查询手机版
  • 服装定制广告语湖南企业seo优化首选
  • 时时彩快3网站开发优化推广网站排名
  • 北京网站建设制作网站建设的推广渠道
  • 网站开发难吗网站推广的要点
  • 中国水运建设行业协会网站阳东网站seo
  • 厦门个人建网站百度网盘官方
  • 做网站策划书吧网络推广员工资多少钱
  • 外贸网站建设制作教程今日热搜第一名
  • 网站建设找客户安徽关键词seo
  • wordpress主题添加一个自定义页面企业站seo案例分析
  • 烟台网站建设技术支持如何推广软件
  • 网站整体风格设计做网络销售如何找客户
  • 中文做网站龙岗百度快速排名
  • 网站群 优点百度知道官网首页登录入口
  • 什么网站能免费做简历seo网站优化论文
  • 哪里做网站最好河北百度seo软件
  • 同一个wifi下_我如何用手机访问我用我电脑做服务器的网站360营销推广
  • 2024图案设计免费生成网站seo专员招聘
  • 免费的网站推广 外贸品牌推广方案怎么写
  • wordpress自媒体主题ming昆明百度关键词优化
  • 常州做网站的公司怎么学seo基础