联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Database作业Database作业

日期:2019-11-03 01:22


INF551– MongoDBLab

100points

Due:11/1/2019,Friday

Consider the New York Times best seller dataset (https://www.kaggle.com/cmenca/new-york-times?hardcover-fiction-best-sellers/). Import the dataset: nyt2.json, into your MongoDB database.

Write a MongoDB operation (find, aggregate, update, etc) for each of the following questions:

1. Find out the number of books whose title contains “history” (case insensitive).

2. Find out how many book were ranked numbered 1 (according to the overall “rank” value).

3. Find out the highest price of the books whose overall rank is top 20 (rank value is from 1 to 20).

(Hint: use aggregate() with a match() for finding the qualified books and then $group, setting _id

set to null, to find out the max value of price among all matched books).

4. Find out, for each publisher, the number of books it published. (list 20 of the query result in .txt)

5. Find out publishers who publish at least 10 books. (list 20 of the query result in .txt)

6. Find out the number of distinct publishers.

7. Find the titles of books published by “Harper” and appeared in the best-selling list at least 5

times. Output the titles in the descending order. (list first 10 of the query result in .txt)

8. Find out the average price of books published by “Harper”.

9. Find the most productive authors (i.e., authors who published the largest number of books).

10. Change the price of book “Breathless” to 28.5. (paste the response after the update in .txt)

Submit a zip file that contains your queries and results.

Submission

1. Name your files as <firstname>_<lastname>_q1.txt, <firstname>_<lastname>_q2.txt, and so on.

2. Submit all .txt files in a zip file with the naming convention: <firstname>_<lastname>_lab3.zip.

(example content of .txt files)


版权所有:留学生编程辅导网 2018 All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。