Created
January 7, 2014 00:05
-
-
Save brendannee/8292378 to your computer and use it in GitHub Desktop.
Dump a mongo collection, or part of a collection from a remote server and import locally
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mongodump -u <USERNAME> -p<PASSWORD> --host <HOSTNAME>:<PORT> --collection <COLLECTION_NAME> -db <REMOTE_DATABASE_NAME> -o ~/Downloads | |
mongorestore --collection <COLLECTION_NAME> --drop -db <LOCAL_DATABASE_NAME> ~/Downloads/<PATH TO BSON FILE> | |
# http://stackoverflow.com/questions/7828817/is-it-possible-to-mongodump-the-last-x-records-from-a-collection/18679197#18679197 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment