Last active
August 29, 2015 13:55
-
-
Save normgraham/8743619 to your computer and use it in GitHub Desktop.
Copy a system.profile collection in a database by dumping it and then restoring it to a new database.collection.
This file contains hidden or 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
| #!/usr/bin/env bash | |
| # Edit the following variables appropriately | |
| SOURCEDB="mydb" | |
| TARGETDB="test" | |
| TARGETCOLL="sp" | |
| mongodump -d $SOURCEDB -c system.profile -o /tmp | |
| mv /tmp/$SOURCEDB/system.profile.bson /tmp/$SOURCEDB/$TARGETCOLL.bson | |
| mongorestore --drop -d $TARGETDB -c $TARGETCOLL /tmp/$SOURCEDB/$TARGETCOLL.bson |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment