{"id":22744559,"url":"https://github.com/goseind/nyt-article-analysis","last_synced_at":"2026-05-05T15:32:09.405Z","repository":{"id":109465313,"uuid":"482489746","full_name":"goseind/nyt-article-analysis","owner":"goseind","description":"Analyzing New York Times Articles and Comments (2020) with MongoDB on a Docker container.","archived":false,"fork":false,"pushed_at":"2022-05-09T14:14:36.000Z","size":3021,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T05:11:22.400Z","etag":null,"topics":["analysis","big-data","database","docker","kaggle","mongo","mongodb","mongodb-atlas"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goseind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-17T10:15:51.000Z","updated_at":"2022-05-05T12:33:09.000Z","dependencies_parsed_at":"2023-05-17T22:45:12.553Z","dependency_job_id":null,"html_url":"https://github.com/goseind/nyt-article-analysis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/goseind/nyt-article-analysis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goseind%2Fnyt-article-analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goseind%2Fnyt-article-analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goseind%2Fnyt-article-analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goseind%2Fnyt-article-analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goseind","download_url":"https://codeload.github.com/goseind/nyt-article-analysis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goseind%2Fnyt-article-analysis/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261735083,"owners_count":23201952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analysis","big-data","database","docker","kaggle","mongo","mongodb","mongodb-atlas"],"created_at":"2024-12-11T01:46:58.861Z","updated_at":"2026-05-05T15:32:09.364Z","avatar_url":"https://github.com/goseind.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# NYT Articles and Comments Analysis MongoDB/Docker\n\nAnalyzing New York Times Articles and Comments (2020) with MongoDB on a Docker container.\n\n## Instructions\n\nYou can find a more detaild description of this repository in this [Blog Post](https://gosein.de/mongo/mongodb/big-data/kaggle/mongodb-atlas/mongodb-charts/analysis/docker/2022/04/17/nyt-articles-analysis-mongodb.html), which also includes a [Video Tutorial on YouTube](https://youtu.be/2HfKDJpGgQ8).\n\nBelow you'll find the commands used in this example step by step, as well as the MongoDB queries in this [file](nyt-mongosh-queries.mongodb).\n\n### Run the Docker Container\n\nCommands to setup the docker container and copy the data into it.\n\n* Link to the official [MongoDB Docker Container](https://hub.docker.com/_/mongo)\n* Link to the [data of NYT](https://www.kaggle.com/datasets/benjaminawd/new-york-times-articles-comments-2020)\n\n```bash\n# Run the docker container\ndocker run --name some-mongo -p 27018:27017 -d mongo:latest # make sure to expose the port so we can access it later with MangoDB Compass\n\n# Check if the container is running\ndocker ps\n\n# Copy data from host to docker container\ndocker cp nyt-articles-2020.csv some-mongo:/nyt.csv\n\n# Open bash on docker container\ndocker exec -it some-mongo bash\n```\n\n### Create a database and import\n\nCommands to create a database and import the data into a collection.\n\n```bash\n# Run mongo shell\nmongo\n\n# Show existing databases\nshow dbs\n\n# Create and use new database\nuse nyt\n\n# Exit mongo shell\nquit\n\n# Import the previously copied csv into the new database\nmongoimport --db nyt --collection nyt_articles --type csv --headerline --ignoreBlanks --file nyt.csv\n\n# Import with specific datatypes\nmongoimport --db nyt --collection nyt_articles_2 --type csv --columnsHaveTypes --fields 'newsdesk.string(),section.string(),subsection.string(),material.string(),headline.string(),abstract.string(),keywords.string(),word_count.int32(),pub_date.date(),n_comments.int32(),uniqueID.string()' --file nyt.csv\n\n# Return to mongo shell\nmongo\n\n# Check the databases again to see if nyt is listed now\nshow dbs\n\n# Use the nyt database\nuse nyt\n```\n\n### Explore and analyze the data\n\nNow that we have stored the data in a database we can execute queries on it. For this part please refer to the separate [query document](nyt-mongosh-queries).\n\n### Using MongoDB Atlas and Charts for visualization\n\nIn my [additional blog post](https://gosein.de/mongo/mongodb/big-data/kaggle/mongodb-atlas/mongodb-charts/analysis/docker/2022/04/17/nyt-articles-analysis-mongodb.html) I explain how to use MongoDB Atlas to create a cluster, import the data there and visualize it with MongoDB Charts.\n\n## Data Source\n\n* [New York Times Articles \u0026 Comments (2020)](https://www.kaggle.com/datasets/benjaminawd/new-york-times-articles-comments-2020), Benjamin Dornel, 04/2022\n\n## License\n\n\u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-sa/4.0/\"\u003e\u003cimg alt=\"Creative Commons License\" style=\"border-width:0\" src=\"https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png\" /\u003e\u003c/a\u003e\u003cbr /\u003eThis work is licensed under a \u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-sa/4.0/\"\u003eCreative Commons Attribution-NonCommercial-ShareAlike 4.0 International License\u003c/a\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoseind%2Fnyt-article-analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoseind%2Fnyt-article-analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoseind%2Fnyt-article-analysis/lists"}