Last active
August 29, 2015 14:17
-
-
Save balkian/25131ca85f4f86c8d57c to your computer and use it in GitHub Desktop.
Copy one collection from a database to another in the same MongoDB
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
db.<collection_name>.find().forEach(function(d){ db.getSiblingDB('<new_database>')['<collection_name>'].insert(d); }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment