M001: MongoDB Basics chapter 1 Introduction学习记录

2024-02-14 21:38

本文主要是介绍M001: MongoDB Basics chapter 1 Introduction学习记录,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

M001: MongoDB Basics chapter 1 Introduction学习记录

运行环境

操作系统:windows 10 家庭中文版
Mongodb :Mongodb 3.4

Mongodb安装路径:E:>MongoDB\Server\3.4\bin\
Mongodb存储路径:E:>MongoDB\data

课后问题

Lab 1.1: Install Compass and Connect

Problem:

If you have not yet downloaded Compass, please follow these instructions. Then answer the question below.

 1. Please download Compass from the MongoDB Download Center.2. Install Compass on your computer from the download.3. Launch Compass.

compass_connect_screen

4. Use the following information to complete this form, but do not click "Connect" yet. Hostname is cluster0-shard-00-00-jxeqq.mongodb.net. Username is m001-student. Password is m001-mongodb-basics.
5. Click "Add to Favorites" so that you can easily connect to our class MongoDB deployment after closing and restarting Compass at some point in the future.
6. Now, click "Connect" and load the databases in the M001 class MongoDB deployment.
When Compass opens you will see a page titled "Connect to Host".

Question Which of the following field names appear in documents in the movies collection of the video database. Check all that apply.

Attempts Remaining:Correct Answer

  • _id
  • cast
  • comments
  • director
  • genre
  • length
  • plot
  • stars

解答

  1. 按照题目给出的地址下载Compass工具,地址:MongoDB Compass
  2. 安装MongoDB Compass工具(图文界面,傻瓜操作)
  3. 启动MongoDB Compass工具,并按所给图示配置,使用所给账号密码登陆远程数据库服务

这里写图片描述

点击连接后进入后显示如图:

这里写图片描述

点击进入video库的movies 集合,观察可知出现过的字段名为:

_id,cast,director,genre,plot

Lab 1.2: Determine the Value Type, Part 1

Problem:
What is the value type of the ts field for documents in the 100YWeatherSmall.data collection?

Choose the best answer:

Attempts Remaining:Correct Answer
* array
* coordinates
* date
* document
* double
* int32
* mixed string and int32
* mixed string and double
* string

解答

按要求使用Compass工具进入100YWeatherSmall库的data集合
点击按table查看集合状态,可观察到ts字段的数据类型:

这里写图片描述

可知其字段类型为ts

Lab 1.3: Determine the Value Type, Part 2

Problem:
What is the value type of the airTemperature field for documents in the 100YWeatherSmall.data collection?

Choose the best answer:

Attempts Remaining:Incorrect Answer
* array
* coordinates
* date
* document
* double
* int32
* mixed string and int32
* mixed string and double
* string

解答

观察可知100YWeatherSmall库的data集合的 airTemperature 字段是个内嵌文档,所以选

document

Lab 1.4: Determine the Value Type, Part 3

Problem:
What is the value type of the year field for documents in the video.movies collection?

Choose the best answer:

Attempts Remaining:Correct Answer
* array
* coordinates
* date
* document
* double
* int32
* mixed string and int32
* mixed string and double
* string

解答

观察可知(方法同Lab 1.2)video库的movies集合中的year字段类型为

int32

Lab 1.5: Scavenger Hunt, Part 1

Problem:
How many movies in the video collection were directed by Patty Jenkins. Stated more precisely, how many documents in the video.movies collection have a value of “Patty Jenkins” for the director field?

Choose the best answer:

Attempts Remaining:Correct Answer
* 6
* 13
* 47
* 98
* 143

解答

按要求进入video库的movies集合,在查询栏输入查询命令:

{"director":"Patty Jenkins"}

查出结果如下:

这里写图片描述

可知总共有6条数据满足条件

Lab 1.6: Scavenger Hunt, Part 2

Problem:
How many documents in the citibike.trips collection have a tripduration that is greater than or equal to 60 and less than 65?

Choose the best answer:

Attempts Remaining:Correct Answer
* 0
* 94
* 216
* 355
* 754

解答

按要求进入citibike库的trips集合,执行查询命令:

{"tripduration":{"$gte":60,"$lt":65}}

查出结果如下:

这里写图片描述

可知总共有754条数据满足条件

Lab 1.7: Scavenger Hunt, Part 3

Problem:
Based on our shipwrecks dataset, how many shipwrecks lay off the coast of Cancun, Mexico? Choose the answer that best describes the number of shipwrecks you are able to find using Compass.

Choose the best answer:

Attempts Remaining:Correct Answer
* 0-10
* 25-50
* 51-100
* 101-200
* 201 or more

解答

按要求进入ships库的shipwrecks集合,并切换至Schema,以图表模式分析schema并快速查看schema:

这里写图片描述

可观察到coordinates字段已经转化为地图模式,在其中查看Mexico的Cancun港的船舶情况:

这里写图片描述

可观察到一条船都没有,所以选择0-10

这篇关于M001: MongoDB Basics chapter 1 Introduction学习记录的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/709636

相关文章

java中pdf模版填充表单踩坑实战记录(itextPdf、openPdf、pdfbox)

《java中pdf模版填充表单踩坑实战记录(itextPdf、openPdf、pdfbox)》:本文主要介绍java中pdf模版填充表单踩坑的相关资料,OpenPDF、iText、PDFBox是三... 目录准备Pdf模版方法1:itextpdf7填充表单(1)加入依赖(2)代码(3)遇到的问题方法2:pd

Zabbix在MySQL性能监控方面的运用及最佳实践记录

《Zabbix在MySQL性能监控方面的运用及最佳实践记录》Zabbix通过自定义脚本和内置模板监控MySQL核心指标(连接、查询、资源、复制),支持自动发现多实例及告警通知,结合可视化仪表盘,可有效... 目录一、核心监控指标及配置1. 关键监控指标示例2. 配置方法二、自动发现与多实例管理1. 实践步骤

在Spring Boot中集成RabbitMQ的实战记录

《在SpringBoot中集成RabbitMQ的实战记录》本文介绍SpringBoot集成RabbitMQ的步骤,涵盖配置连接、消息发送与接收,并对比两种定义Exchange与队列的方式:手动声明(... 目录前言准备工作1. 安装 RabbitMQ2. 消息发送者(Producer)配置1. 创建 Spr

k8s上运行的mysql、mariadb数据库的备份记录(支持x86和arm两种架构)

《k8s上运行的mysql、mariadb数据库的备份记录(支持x86和arm两种架构)》本文记录在K8s上运行的MySQL/MariaDB备份方案,通过工具容器执行mysqldump,结合定时任务实... 目录前言一、获取需要备份的数据库的信息二、备份步骤1.准备工作(X86)1.准备工作(arm)2.手

SpringBoot3应用中集成和使用Spring Retry的实践记录

《SpringBoot3应用中集成和使用SpringRetry的实践记录》SpringRetry为SpringBoot3提供重试机制,支持注解和编程式两种方式,可配置重试策略与监听器,适用于临时性故... 目录1. 简介2. 环境准备3. 使用方式3.1 注解方式 基础使用自定义重试策略失败恢复机制注意事项

Python UV安装、升级、卸载详细步骤记录

《PythonUV安装、升级、卸载详细步骤记录》:本文主要介绍PythonUV安装、升级、卸载的详细步骤,uv是Astral推出的下一代Python包与项目管理器,主打单一可执行文件、极致性能... 目录安装检查升级设置自动补全卸载UV 命令总结 官方文档详见:https://docs.astral.sh/

统一返回JsonResult踩坑的记录

《统一返回JsonResult踩坑的记录》:本文主要介绍统一返回JsonResult踩坑的记录,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录统一返回jsonResult踩坑定义了一个统一返回类在使用时,JsonResult没有get/set方法时响应总结统一返回

Go学习记录之runtime包深入解析

《Go学习记录之runtime包深入解析》Go语言runtime包管理运行时环境,涵盖goroutine调度、内存分配、垃圾回收、类型信息等核心功能,:本文主要介绍Go学习记录之runtime包的... 目录前言:一、runtime包内容学习1、作用:① Goroutine和并发控制:② 垃圾回收:③ 栈和

java对接海康摄像头的完整步骤记录

《java对接海康摄像头的完整步骤记录》在Java中调用海康威视摄像头通常需要使用海康威视提供的SDK,下面这篇文章主要给大家介绍了关于java对接海康摄像头的完整步骤,文中通过代码介绍的非常详细,需... 目录一、开发环境准备二、实现Java调用设备接口(一)加载动态链接库(二)结构体、接口重定义1.类型

Android学习总结之Java和kotlin区别超详细分析

《Android学习总结之Java和kotlin区别超详细分析》Java和Kotlin都是用于Android开发的编程语言,它们各自具有独特的特点和优势,:本文主要介绍Android学习总结之Ja... 目录一、空安全机制真题 1:Kotlin 如何解决 Java 的 NullPointerExceptio