Skip to content

Instantly share code, notes, and snippets.

@ravyg
Last active January 22, 2017 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ravyg/e4ce4137860e527f3c70950cd7f3fa74 to your computer and use it in GitHub Desktop.
Save ravyg/e4ce4137860e527f3c70950cd7f3fa74 to your computer and use it in GitHub Desktop.
AWS, Mongo, Dynamo Commands
# Importing a db with multiple bson files
# Note each bson is a collection.
mongorestore -d db_name path/
# To start db use:
mongo db_name
# To see collections use:
show collections
# Start mongo service:
brew services start mongodb
mongo
# Stop mongo service.
brew services stop mongodb
# Import a single bson file
mongorestore -d db_name -c collection_name path/file.bson
# Counting resources
> db.my_name.find({text:/sometext/i}).count()
149513
# Check port and host.
sudo lsof -iTCP -sTCP:LISTEN | grep mongo
# Date bounded
db.tweets_no_dup.find({created_at_ts: { $gt: 1420088400, $lt: 1451624400 }}).count()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment