一文带你搞懂爬虫储存数据库MongoDB

开发 后端 其他数据库 MongoDB
MongoDB 是非关系型数据库的代表,一款基于键值储存的高性能数据库。常作为爬虫储存数据库。MongoDB 是一个基于分布式文件存储的数据库。由 C++ 语言编写。旨在为 WEB 应用提供可扩展的高性能数据存储解决方案。

[[412371]]

Hello,大家好。我是吴老板。

前言

MongoDB 是非关系型数据库的代表,一款基于键值储存的高性能数据库。常作为爬虫储存数据库。

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

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

参考资料:

https://www.runoob.com/mongodb/mongodb-tutorial.html

连接 MongoDB

格式: mongodb://username:password@host:port/database

  • mongodb://:固定的连接头,必须要指定。
  • username:password:用户名密码验证,如果密码为空可不填
  • host:指定host, URI 是唯一必填项。它指定了要连接服务器的地址。
  • port:指定端口,如果不填,默认为 27017
  • database:若不指定,默认打开 test 数据库。

创建数据库、集合

尝试创建数据库 地下交通站

我们使用中文命名我们的第一个数据库

  1. > use 地下交通站 
  2. switched to db 地下交通站 
  3. > db 
  4. 地下交通站 

如果该数据库已存在则会切换到此库,如果没有,则创建。

查看数据库列表

  1. > show dbs 
  2. admin   0.000GB 
  3. config  0.000GB 
  4. local   0.000GB 

在 MongoDB中,数据库必须要有数据才能在列表中看到它,这一点和其他数据库还是有很大的不同,我们将在稍后尝试插入数据。

尝试创建集合 Quotations

  1. > db.createCollection("Quotations"
  2. "ok" : 1 } 

这样一个集合就创建成功了。

查看 数据库地下交通站 中的所有集合

  1. > show collections 
  2. Quotations 

删库就更简单了,跑路才难 !!

删除一个数据库

  1. > use 地下交通站 
  2. switched to db 地下交通站 
  3.  
  4. > db.dropDatabase() 
  5. "dropped" : "地下交通站""ok" : 1 } 

这样一个MongoDB数据库就没了。

删除一个集合

  1. > use 地下交通站 
  2. switched to db 地下交通站 
  3. > db.Quotations.drop()  # 删除集合 

这样数据库地下交通站 中的Quotations集合就没了 !

插入文档

MongoDB 是一个面向文档存储的数据库,操作起来比较简单和容易。

MongoDB 中一条数据被视为一个文档,而一个表则被称为一个集合(Collection)。

db.collection.insertOne() 用于向集合插入一个新文档(单个json对象)

db.collection.insertMany() 用于向集合插入一个多个文档(json对象列表)

尝试插入一条数据

在数据库地下交通站中的Quotations 集合中插入一条数据

  1. > use 地下交通站 
  2. switched to db 地下交通站 
  3.  
  4. > db.Quotations.insert({ 
  5.    name'贾贵'
  6.    description: '老子在这欠的饭钱够你吃二年的'
  7.    createDate: '2021-04-15' 
  8.  }) 
  9. WriteResult({ "nInserted" : 1 }) 

查看已插入文档记录

  1. > db.Quotations.find({}) 
  2. "_id" : ObjectId("6078e9743252cc07e092d204"), "name" : "贾贵""description" : "老子在这欠的饭钱够你吃二年的""createDate" : "2021-04-15" } 

可以看到 MongoDB 集合自动帮我们生成了 _id 字段用于唯一索引 !!

尝试插入多条数据

  1. > db.Quotations.insertMany([ 
  2.          {name'黄金标',description: '这秤砣也TM炖熟了',createDate: '2021-04-15'}, 
  3.          {name'贾贵',description: '我捂着脑袋捂着脸撅着屁股就跟他打起来了',createDate: '2021-04-16'}, 
  4.          {name'黑藤',description: '你说我他么是谁,我他么是黑藤',createDate: '2021-04-16'}, 
  5.          {name'孙友福',description: '没有水就没有鱼,没有你就没有驴',createDate: '2021-04-17'
  6.      ]) 
  1. > db.Quotations.find({}) 
  2. "_id" : ObjectId("6078e9743252cc07e092d204"), "name" : "贾贵""description" : "老子在这欠的饭钱够你吃二年的""createDate" : "2021-04-15" } 
  3. "_id" : ObjectId("6078ebd395708b77ad7a8bd8"), "name" : "黄金标""description" : "这秤砣也TM炖熟了""createDate" : "2021-04-15" } 
  4. "_id" : ObjectId("6078ebd395708b77ad7a8bd9"), "name" : "贾贵""description" : "我捂着脑袋捂着脸撅着屁股就跟他打起来了""createDate" : "2021-04-16" } 
  5. "_id" : ObjectId("6078ebd395708b77ad7a8bda"), "name" : "黑藤""description" : "你说我他么是谁,我他么是黑藤""createDate" : "2021-04-16" } 
  6. "_id" : ObjectId("6078ebd395708b77ad7a8bdb"), "name" : "孙友福""description" : "没有水就没有鱼,没有你就没有驴""createDate" : "2021-04-17" } 

更新文档

尝试更新 name 字段(单条文档)

  1. > db.Quotations.update({'name':'黑藤'},{$set:{name'黑藤',description: '天下汉奸一般蠢',createDate: '2021-04-16'}}) 

更改生效

  1. > db.Quotations.find({})                                                                                 1-04-16'}}) 
  2. "_id" : ObjectId("6078e9743252cc07e092d204"), "name" : "贾贵""description" : "老子在这欠的饭钱够你吃二年的""createDate" : "2021-04-15" } 
  3. "_id" : ObjectId("6078ebd395708b77ad7a8bd8"), "name" : "黄金标""description" : "这秤砣也TM炖熟了""createDate" : "2021-04-15" } 
  4. "_id" : ObjectId("6078ebd395708b77ad7a8bd9"), "name" : "贾贵""description" : "我捂着脑袋捂着脸撅着屁股就跟他打起来了""createDate" : "2021-04-16" } 
  5. "_id" : ObjectId("6078ebd395708b77ad7a8bda"), "name" : "黑藤""description" : "天下汉奸一般蠢""createDate" : "2021-04-16" } 
  6. "_id" : ObjectId("6078ebd395708b77ad7a8bdb"), "name" : "孙友福""description" : "没有水就没有鱼,没有你就没有驴""createDate" : "2021-04-17" } 

尝试更新所有文档

  1. > db.Quotations.update({'name':'贾贵'},{$set: {name'贾贵',description: '这我哪知道呀!我知道她长的嘿!',createDate: '2021-04-16'}},{multi:true}) 
  1. > db.Quotations.find({})                                                                                      
  2. "_id" : ObjectId("6078e9743252cc07e092d204"), "name" : "贾贵""description" : "这我哪知道呀!我知道她长的嘿!""createDate" : "2021-04-16" } 
  3. "_id" : ObjectId("6078ebd395708b77ad7a8bd8"), "name" : "黄金标""description" : "这秤砣也TM炖熟了""createDate" : "2021-04-15" } 
  4. "_id" : ObjectId("6078ebd395708b77ad7a8bd9"), "name" : "贾贵""description" : "这我哪知道呀!我知道她长的嘿!""createDate" : "2021-04-16" } 
  5. "_id" : ObjectId("6078ebd395708b77ad7a8bda"), "name" : "黑藤""description" : "天下汉奸一般蠢""createDate" : "2021-04-16" } 
  6. "_id" : ObjectId("6078ebd395708b77ad7a8bdb"), "name" : "孙友福""description" : "没有水就没有鱼,没有你就没有驴""createDate" : "2021-04-17" } 

这里我们将 multi 参数设置成 True,意味着将更新所有匹配查询条件的文档

发现所有name 为贾贵的语录都改变了。

不存在则新增

设置 upsert 参数为True, 更新不存在则新增。

  1. > db.Quotations.update({'name':'濑川'},{$set:{ 'name' : '濑川''description' : '去东关,捣乱的干活'}},{upsert:true}) 
  1. > db.Quotations.find({})                                              
  2. "_id" : ObjectId("6078e9743252cc07e092d204"), "name" : "贾贵""description" : "这我哪知道呀!我知道她长的嘿!""createDate" : "2021-04-16" } 
  3. "_id" : ObjectId("6078ebd395708b77ad7a8bd8"), "name" : "黄金标""description" : "这秤砣也TM炖熟了""createDate" : "2021-04-15" } 
  4. "_id" : ObjectId("6078ebd395708b77ad7a8bd9"), "name" : "贾贵""description" : "这我哪知道呀!我知道她长的嘿!""createDate" : "2021-04-16" } 
  5. "_id" : ObjectId("6078ebd395708b77ad7a8bda"), "name" : "黑藤""description" : "天下汉奸一般蠢""createDate" : "2021-04-16" } 
  6. "_id" : ObjectId("6078ebd395708b77ad7a8bdb"), "name" : "孙友福""description" : "没有水就没有鱼,没有你就没有驴""createDate" : "2021-04-17" } 
  7. "_id" : ObjectId("6078ee01249a48b5bb83b936"), "name" : "濑川""description" : "去东关,捣乱的干活" } 

发现新增了一条 name 为 濑川 的文档记录

与此同时, 我建议 使用 update_one 方法更新单个文档, 使用 update_many 方法更新多个文档。

删除文档

删除匹配查询条件的所有文档

  1. > db.Quotations.remove({'name':'贾贵'}) 
  2. WriteResult({ "nRemoved" : 2 }) 
  1. > db.Quotations.find({})     
  2. "_id" : ObjectId("6078ebd395708b77ad7a8bd8"), "name" : "黄金标""description" : "这秤砣也TM炖熟了""createDate" : "2021-04-15" } 
  3. "_id" : ObjectId("6078ebd395708b77ad7a8bda"), "name" : "黑藤""description" : "天下汉奸一般蠢""createDate" : "2021-04-16" } 
  4. "_id" : ObjectId("6078ebd395708b77ad7a8bdb"), "name" : "孙友福""description" : "没有水就没有鱼,没有你就没有驴""createDate" : "2021-04-17" } 
  5. "_id" : ObjectId("6078ee01249a48b5bb83b936"), "name" : "濑川""description" : "去东关,捣乱的干活" } 

这样就把 name 为 贾贵的所有文档记录全都干掉了。

删除集合中所有文档

  1. > db.Quotations.remove({}) 

{} 表示无条件,默认移除全部文档,等价于删除此集合。

查询文档

MongoDB 查询数据的通用语法

  1. db.collection.find(query, projection) 

条件查询

指定非 _id 字段 查询

  1. > use 地下交通站 
  2. switched to db 地下交通站 
  3. > db.Quotations.find({},{'_id':0}) 
  4. "name" : "黑藤""description" : "天下汉奸一般蠢""createDate" : "2021-04-16" } 
  5. "name" : "孙友福""description" : "没有水就没有鱼,没有你就没有驴""createDate" : "2021-04-17" } 
  6. "name" : "濑川""description" : "去东关,捣乱的干活" } 
  7. "name" : "黄金标""createDate" : "2021-04-26""description" : "刘副官你记住了,让皇军先尿。" } 
  8. "name" : "贾贵""createDate" : "2021-04-18""description" : "我啐他一脸狗屎" } 
  9. "name" : "黄金标""createDate" : "2021-04-26""description" : "刘副官你记住了,让皇军先尿。" } 

为了美化输出,可以使用 pretty() 方法,此方法对 sql 事务不起到任何意义

  1. db.Quotations.find({},{'_id':0}).pretty() 

AND 查询

查询 [ name 为 黄金标 ] 并且 [ createDate 为 2021-04-26 ] 的所有文档记录

  1. > db.Quotations.find({"name":"黄金标""createDate":"2021-04-26"}) 
  2. "_id" : ObjectId("6078f0e31e12a856cf9525da"), "name" : "黄金标""createDate" : "2021-04-26""description" : "刘副官你记住了,让皇军先尿。" } 
  3. "_id" : ObjectId("6078f2091e12a856cf9525dd"), "name" : "黄金标""createDate" : "2021-04-26""description" : "刘副官你记住了,让皇军先尿。" } 

OR 查询

查询 [ name 为 贾贵 ] 或者 [ description 为 天下汉奸一般蠢 ] 的所有文档记录

  1. > db.Quotations.find({$or:[{"name":"贾贵"},{"description""天下汉奸一般蠢"}]}) 
  2. "_id" : ObjectId("6078ebd395708b77ad7a8bda"), "name" : "黑藤""description" : "天下汉奸一般蠢""createDate" : "2021-04-16" } 
  3. "_id" : ObjectId("6078f2091e12a856cf9525dc"), "name" : "贾贵""createDate" : "2021-04-18""description" : "我啐他一脸狗屎" } 

可以看到在这里 OR 查询使用了显式操作($or 后接条件列表), OR操作一定是显式的,不存在隐式的OR操作。

而上面的 AND查询 操作是不是可以尝试也写成 显式操作

  1. > db.Quotations.find({$and:[{"name":"黄金标"},{"createDate""2021-04-26"}]}) 
  2. "_id" : ObjectId("6078f0e31e12a856cf9525da"), "name" : "黄金标""createDate" : "2021-04-26""description" : "刘副官你记住了,让皇军先尿。" } 
  3. "_id" : ObjectId("6078f2091e12a856cf9525dd"), "name" : "黄金标""createDate" : "2021-04-26""description" : "刘副官你记住了,让皇军先尿。" } 

发现也是可以的 !!

AND 和 OR 联合使用

查询 [ createDate 为 2021-04-18 ] 并且 [ [ name 为 贾贵 ] 或者 [ description 为 天下汉奸一般蠢 ] ] 的所有文档记录

伪sql语句表述为:

  1. where createDate='2021-04-18' AND (name = '贾贵' OR description = '天下汉奸一般蠢'
  1. > db.Quotations.find({"createDate""2021-04-18", $or: [{"name""贾贵"},{"description""天下汉奸一般蠢"}]}) 
  2. "_id" : ObjectId("6078f2091e12a856cf9525dc"), "name" : "贾贵""createDate" : "2021-04-18""description" : "我啐他一脸狗屎" } 

高级查询

范围查询、正则查询

  • $lt 小于
  • $gt 大于
  • $lte 小于等于
  • $gte 大于等于
  • $ne 不等于
  • $in 在范围内
  • $nin 不在范围内

查询创建时间 大于 2021-04-17 的所有文档记录

  1. > db.Quotations.find({"createDate" : {$gt : "2021-04-17"}}) 
  2. "_id" : ObjectId("6078f0e31e12a856cf9525da"), "name" : "黄金标""createDate" : "2021-04-26""description" : "刘副官你记住了,让皇军先尿。" } 
  3. "_id" : ObjectId("6078f2091e12a856cf9525dc"), "name" : "贾贵""createDate" : "2021-04-18""description" : "我啐他一脸狗屎" } 
  4. "_id" : ObjectId("6078f2091e12a856cf9525dd"), "name" : "黄金标""createDate" : "2021-04-26""description" : "刘副官你记住了,让皇军先尿。" } 

查询 [ name 不等于 黄金标 ] 并且 [ createDate 小于 2021-04-26 ] 的所有文档记录

  1. > db.Quotations.find({"name" : {$ne : "黄金标"},"createDate":{$lt : "2021-04-26"}}) 
  2. "_id" : ObjectId("6078ebd395708b77ad7a8bda"), "name" : "黑藤""description" : "天下汉奸一般蠢""createDate" : "2021-04-16" } 
  3. "_id" : ObjectId("6078ebd395708b77ad7a8bdb"), "name" : "孙友福""description" : "没有水就没有鱼,没有你就没有驴""createDate" : "2021-04-17" } 
  4. "_id" : ObjectId("6078f2091e12a856cf9525dc"), "name" : "贾贵""createDate" : "2021-04-18""description" : "我啐他一脸狗屎" } 

查询 [ name 包含 黄金标、贾贵 ] 并且 [ createDate 大于 2021-04-02 ] 的所有文档记录

  1. > db.Quotations.find({"name" : {$in : ["黄金标","贾贵"]},"createDate":{$gt : "2021-04-02"}}) 
  2. "_id" : ObjectId("6078f0e31e12a856cf9525da"), "name" : "黄金标""createDate" : "2021-04-26""description" : "刘副官你记住了,让皇军先尿。" } 
  3. "_id" : ObjectId("6078f2091e12a856cf9525dc"), "name" : "贾贵""createDate" : "2021-04-18""description" : "我啐他一脸狗屎" } 
  4. "_id" : ObjectId("6078f2091e12a856cf9525dd"), "name" : "黄金标""createDate" : "2021-04-26""description" : "刘副官你记住了,让皇军先尿。" } 
  • $regex 匹配正则
  • $exists 属性是否存在
  • $type 类型判断
  • $mod 数字模操作
  • $text 文本查询
  • $where 高级条件查询

利用正则语句匹配 name 中带有 金标 的所有文档

  1. > db.Quotations.find({"name":{"$regex":"金标"}}) 
  2. "_id" : ObjectId("6078f0e31e12a856cf9525da"), "name" : "黄金标""createDate" : "2021-04-26""description" : "刘副官你记住了,让皇军先尿。" } 
  3. "_id" : ObjectId("6078f2091e12a856cf9525dd"), "name" : "黄金标""createDate" : "2021-04-26""description" : "刘副官你记住了,让皇军先尿。" } 

利用正则语句匹配 以 我 开头的 description 的所有文档

  1. > db.Quotations.find({"description":{"$regex":"^我"}}) 
  2. "_id" : ObjectId("6078f2091e12a856cf9525dc"), "name" : "贾贵""createDate" : "2021-04-18""description" : "我啐他一脸狗屎" } 

利用正则语句匹配 以 我 开头、以 屎 结尾 description 的所有文档

  1. > db.Quotations.find({"description":{"$regex":"^我.*屎$"}}) 
  2. "_id" : ObjectId("6078f2091e12a856cf9525dc"), "name" : "贾贵""createDate" : "2021-04-18""description" : "我啐他一脸狗屎" } 

更多高级查询用法各位读者请参考 MongoDB 官方文档

聚合函数

排序

在 MongoDB 中使用 sort() 方法对数据进行排序,sort() 方法可以通过参数指定排序的字段, 并使用 1 和 -1 来指定排序的方式, 其中 1 为升序排列,而 -1 是用于降序排列。

我们总是喜欢用时间维度来排序集合中的文档

  1. > db.Quotations.find({},{"_id":0}).sort({"createDate":-1}) 
  2. "name" : "黄金标""createDate" : "2021-04-26""description" : "刘副官你记住了,让皇军先尿。" } 
  3. "name" : "黄金标""createDate" : "2021-04-26""description" : "刘副官你记住了,让皇军先尿。" } 
  4. "name" : "贾贵""createDate" : "2021-04-18""description" : "我啐他一脸狗屎" } 
  5. "name" : "孙友福""description" : "没有水就没有鱼,没有你就没有驴""createDate" : "2021-04-17" } 
  6. "name" : "黑藤""description" : "天下汉奸一般蠢""createDate" : "2021-04-16" } 
  7. "name" : "濑川""description" : "去东关,捣乱的干活" } 

分组

  1. db.Quotations.aggregate({$group:{_id:{name:"$name"}}}) 

根据 name 和 description 字段进行分组

  1. db.Quotations.aggregate({ 
  2.     $group:{ 
  3.         _id:{name:"$name",description:"$description"
  4. }}) 

由于我们现有集合文档的字段中并没有可计算的数值

我们尝试添加一个集合字段并先赋值为空

  1. db.Quotations.update({},{$set:{"forceValue"""}},{multi:true}) 

添加随机值

  1. db.Quotations.update({"name":"黑藤"},{$set:{"forceValue": Math.random()*100}},{multi:true}) 
  2. db.Quotations.update({"name":"孙友福"},{$set:{"forceValue": Math.random()*100}},{multi:true}) 
  3. db.Quotations.update({"name":"濑川"},{$set:{"forceValue": Math.random()*100}},{multi:true}) 
  4. db.Quotations.update({"name":"黄金标"},{$set:{"forceValue": Math.random()*100}},{multi:true}) 
  5. db.Quotations.update({"name":"贾贵"},{$set:{"forceValue": Math.random()*100}},{multi:true}) 

结果如下

  1. "name" : "黑藤""description" : "天下汉奸一般蠢""createDate" : "2021-04-16""forceValue" : 14.796604243632927 } 
  2. "name" : "孙友福""description" : "没有水就没有鱼,没有你就没有驴""createDate" : "2021-04-17""forceValue" : 43.71427504449847 } 
  3. "name" : "濑川""description" : "去东关,捣乱的干活""forceValue" : 41.53502198761502 } 
  4. "name" : "黄金标""createDate" : "2021-04-26""description" : "刘副官你记住了,让皇军先尿。""forceValue" : 21.887495918176125 } 
  5. "name" : "贾贵""createDate" : "2021-04-18""description" : "我啐他一脸狗屎""forceValue" : 94.18697675337746 } 

由于要用到分组,我们需要多添加几条文档数据

  1. db.Quotations.insertMany([ 
  2.          {name'黄金标',description: '我黄某人为官一任就得保一方平安',forceValue:Math.random()*100,createDate: '2021-04-11'}, 
  3.          {name'贾贵',description: '皇军没来的时候,你欺负我,皇军来了你还欺负我,那皇军不是TM白来了吗',forceValue:Math.random()*100,createDate: '2021-04-14'}, 
  4.          {name'黑藤',description: '全东亚乃至全亚洲都找不到第二张想你这么一张空前绝后的脸来',forceValue:Math.random()*100,createDate: '2021-04-22'}, 
  5.          {name'贾贵',description: '这我哪知道啊,我就知道她长得嘿',forceValue:Math.random()*100, createDate: '2021-04-19'
  6.      ]) 

分组使用聚合函数

常用聚合函数

  • $sum
  • $avg
  • $max
  • $min
  • $first
  • $last

根据 name 分组并使用 $sum 函数求和,得到一下结果

  • $match 查询条件
  • $group 根据字段分组(可以是多字段) + 聚合函数
  1. > db.Quotations.aggregate( 
  2. ...     {"$match":{"createDate":{"$gt":"2021-04-07"}}}, 
  3. ...     {"$group":{"_id":"$name",'forceValue':{"$sum":"$forceValue"}}}, 
  4. ... ) 
  5. "_id" : "贾贵""forceValue" : 204.22774268609504 } 
  6. "_id" : "黄金标""forceValue" : 121.14812944012357 } 
  7. "_id" : "黑藤""forceValue" : 91.2583132098972 } 
  8. "_id" : "孙友福""forceValue" : 43.71427504449847 } 

这相当于在 Mysql 中执行

  1. select id,sum(forceValue) from Quotations where createDate > "2021-04-07" group by name;   

$avg 求平均

  1. > db.Quotations.aggregate( 
  2. ...     {"$match":{"createDate":{"$gt":"2021-04-07"}}}, 
  3. ...     {"$group":{"_id":"$name",'forceValue':{"$avg":"$forceValue"}}}, 
  4. ... ) 
  5. "_id" : "贾贵""forceValue" : 68.07591422869835 } 
  6. "_id" : "黄金标""forceValue" : 60.574064720061784 } 
  7. "_id" : "黑藤""forceValue" : 45.6291566049486 } 
  8. "_id" : "孙友福""forceValue" : 43.71427504449847 } 

多字段分组

根据 createDate + name 进行分组之后求和

  1. > db.Quotations.aggregate( 
  2. ... ...     {"$match":{"createDate":{"$gt":"2021-04-07"}}}, 
  3. ... ...     {"$group":{"_id":{"createDate":"$createDate","name":"$name"},'forceValue':{"$sum":"$forceValue"}}}, 
  4. ... ... ) 
  5. "_id" : { "createDate" : "2021-04-11""name" : "黄金标" }, "forceValue" : 99.26063352194744 } 
  6. "_id" : { "createDate" : "2021-04-16""name" : "黑藤" }, "forceValue" : 14.796604243632927 } 
  7. "_id" : { "createDate" : "2021-04-17""name" : "孙友福" }, "forceValue" : 43.71427504449847 } 
  8. "_id" : { "createDate" : "2021-04-18""name" : "贾贵" }, "forceValue" : 94.18697675337746 } 
  9. "_id" : { "createDate" : "2021-04-26""name" : "黄金标" }, "forceValue" : 21.887495918176125 } 
  10. "_id" : { "createDate" : "2021-04-14""name" : "贾贵" }, "forceValue" : 81.9931941785778 } 
  11. "_id" : { "createDate" : "2021-04-22""name" : "黑藤" }, "forceValue" : 76.46170896626427 } 
  12. "_id" : { "createDate" : "2021-04-19""name" : "贾贵" }, "forceValue" : 28.04757175413979 } 

我不能再继续写下去了,MongoDB 的基础入门就介绍到这里 🍺

更多教程请参考 MongoDB官方文档

结束语

我是吴老板,以上就是我们这次的干货分享了。最后重申下:

MongoDB 是非关系型数据库的代表,一款基于键值储存的高性能数据库。常作为爬虫储存数据库。

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

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

 

责任编辑:姜华 来源: Python爬虫与数据挖掘
相关推荐

2023-03-06 21:29:41

mmap技术操作系统

2023-07-17 10:45:03

向量数据库NumPy

2023-02-13 23:39:48

数据库Mongodb存储

2023-11-29 16:16:14

Redis数据库

2021-11-22 06:21:31

Python数据类型Python基础

2021-11-20 10:27:43

Python数据类型

2021-11-06 10:18:30

Python变量常量

2022-03-24 08:51:48

Redis互联网NoSQL

2020-05-15 16:37:13

PowerBI数据分析

2021-09-07 09:46:40

JavaScriptGenerator函数

2021-09-11 10:41:27

PythonPickle模块

2021-04-22 09:01:35

MongoDB数据库NoSql数据库

2020-05-11 14:35:11

微服务架构代码

2021-03-06 08:04:46

NginxHttpHttps

2020-02-21 20:10:13

搞懂事务隔离级别

2022-02-14 21:17:21

RPC框架协议

2021-08-05 06:54:05

观察者订阅设计

2021-12-01 11:40:14

Python 输入输出

2020-10-08 14:32:57

大数据工具技术

2021-07-28 10:41:21

python
点赞
收藏

51CTO技术栈公众号