Test mongoDB aggregations
Prerequesites: You need to have docker and docker-compose installed. (docker --version
to make sure you have it)
-
docker-compose build
-
docker-compose up -d
-
[Optional] To detach your console, you can press CTRL+P and CTRL+Q
-
[Optional] Make sure your container is running:
docker-compose ps
-
[Optional] Make sure Mongo is listening:
curl localhost:27018
We are going to use Reddit comment dump shared by reddit user \Stuck_In_the_Matrix (thank you!)
- Original post: https://www.reddit.com/r/datasets/comments/3bxlg7/i_have_every_publicly_available_reddit_comment/
- Torrent link: https://mega.nz/#!ysBWXRqK!yPXLr25PgJi184pbJU3GtnqUY4wG7YvuPpxJjEmnb9A
docker exec -i -t mongo-db /bin/bash
mongo
- Create a new
reddit
database andcomments
collection - Exit mongo
- From Host: Unzip RC_2015-01 file and move it to
./shared
folder - From Container:
cd /shared
andmongoimport --db reddit --collection comments --file RC_2015-01
Example: