Sign inSign up

isx45128227/mongotwitter

By isx45128227

•Updated over 8 years ago

Docker to test queries in MongoDB.

Image
0

215

isx45128227/mongotwitter repository overview

First of all we download and run MongoDB docker.

[user@host ]$ docker run --name mongotwitter -h mongotwitter -d isx45128227/mongotwitter

There is a problem with Docker and MongoDB. Docker interface does not allow Mongo to keep database data, so before we start using our docker mongo we have to restore database information.

First of all we enter into the docker.

[user@host ]$ docker exec -it mongotwitter /bin/bash

Then we run a script that regenerates all twitter database.

./tmp/restore.sh

Later we run our queries using mongo. We can run this command inside the docker or if we have MongoDB installed in our machine we can run it outside. Check first the ip address of your docker, it could not be the same.

[user@host ]$ mongo --host 172.17.0.3:27017 twitter

When we are inside mongo shell we can start running different queries.

db.users.find()

db.tweets.find({"text_tweet":/#sale/i}).count()

db.tweets.find({"text_tweet":/#/i})

Tag summary

Content type

Image

Digest

Size

451.5 MB

Last updated

over 8 years ago

docker pull isx45128227/mongotwitter