Last active
May 15, 2018 20:34
-
-
Save wyllie/8f67b301a2325ea3d6b09affc1099b7b to your computer and use it in GitHub Desktop.
Copy MongoDB Atlas collection
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
# this will copy the collection 'my_original' to 'my_copy' | |
db.my_original.aggregate([{$match: {}}, {$out: "my_copy"}]) | |
# to move the collection to another db within the same Atlas mongodb cluster | |
db.adminCommand({renameCollection: "my_db.my_copy", to: "other_db.other_name"}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment