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

相关文章

Python获取中国节假日数据记录入JSON文件

《Python获取中国节假日数据记录入JSON文件》项目系统内置的日历应用为了提升用户体验,特别设置了在调休日期显示“休”的UI图标功能,那么问题是这些调休数据从哪里来呢?我尝试一种更为智能的方法:P... 目录节假日数据获取存入jsON文件节假日数据读取封装完整代码项目系统内置的日历应用为了提升用户体验,

Spring Boot 配置文件之类型、加载顺序与最佳实践记录

《SpringBoot配置文件之类型、加载顺序与最佳实践记录》SpringBoot的配置文件是灵活且强大的工具,通过合理的配置管理,可以让应用开发和部署更加高效,无论是简单的属性配置,还是复杂... 目录Spring Boot 配置文件详解一、Spring Boot 配置文件类型1.1 applicatio

MySQL INSERT语句实现当记录不存在时插入的几种方法

《MySQLINSERT语句实现当记录不存在时插入的几种方法》MySQL的INSERT语句是用于向数据库表中插入新记录的关键命令,下面:本文主要介绍MySQLINSERT语句实现当记录不存在时... 目录使用 INSERT IGNORE使用 ON DUPLICATE KEY UPDATE使用 REPLACE

Python 中的异步与同步深度解析(实践记录)

《Python中的异步与同步深度解析(实践记录)》在Python编程世界里,异步和同步的概念是理解程序执行流程和性能优化的关键,这篇文章将带你深入了解它们的差异,以及阻塞和非阻塞的特性,同时通过实际... 目录python中的异步与同步:深度解析与实践异步与同步的定义异步同步阻塞与非阻塞的概念阻塞非阻塞同步

Python Dash框架在数据可视化仪表板中的应用与实践记录

《PythonDash框架在数据可视化仪表板中的应用与实践记录》Python的PlotlyDash库提供了一种简便且强大的方式来构建和展示互动式数据仪表板,本篇文章将深入探讨如何使用Dash设计一... 目录python Dash框架在数据可视化仪表板中的应用与实践1. 什么是Plotly Dash?1.1

Spring Boot中定时任务Cron表达式的终极指南最佳实践记录

《SpringBoot中定时任务Cron表达式的终极指南最佳实践记录》本文详细介绍了SpringBoot中定时任务的实现方法,特别是Cron表达式的使用技巧和高级用法,从基础语法到复杂场景,从快速启... 目录一、Cron表达式基础1.1 Cron表达式结构1.2 核心语法规则二、Spring Boot中定

Java进阶学习之如何开启远程调式

《Java进阶学习之如何开启远程调式》Java开发中的远程调试是一项至关重要的技能,特别是在处理生产环境的问题或者协作开发时,:本文主要介绍Java进阶学习之如何开启远程调式的相关资料,需要的朋友... 目录概述Java远程调试的开启与底层原理开启Java远程调试底层原理JVM参数总结&nbsMbKKXJx

国内环境搭建私有知识问答库踩坑记录(ollama+deepseek+ragflow)

《国内环境搭建私有知识问答库踩坑记录(ollama+deepseek+ragflow)》本文给大家利用deepseek模型搭建私有知识问答库的详细步骤和遇到的问题及解决办法,感兴趣的朋友一起看看吧... 目录1. 第1步大家在安装完ollama后,需要到系统环境变量中添加两个变量2. 第3步 “在cmd中

Spring Retry 实现乐观锁重试实践记录

《SpringRetry实现乐观锁重试实践记录》本文介绍了在秒杀商品SKU表中使用乐观锁和MybatisPlus配置乐观锁的方法,并分析了测试环境和生产环境的隔离级别对乐观锁的影响,通过简单验证,... 目录一、场景分析 二、简单验证 2.1、可重复读 2.2、读已提交 三、最佳实践 3.1、配置重试模板

在 Spring Boot 中使用异步线程时的 HttpServletRequest 复用问题记录

《在SpringBoot中使用异步线程时的HttpServletRequest复用问题记录》文章讨论了在SpringBoot中使用异步线程时,由于HttpServletRequest复用导致... 目录一、问题描述:异步线程操作导致请求复用时 Cookie 解析失败1. 场景背景2. 问题根源二、问题详细分