How to copy a collection from one database to another in MongoDB

The best way is to do a mongodump then mongorestore. You can select the collection via: mongodump -d some_database -c some_collection [Optionally, zip the dump (zip some_database.zip some_database/* -r) and scp it elsewhere] Then restore it: mongorestore -d some_other_db -c some_or_other_collection dump/some_collection.bson Existing data in some_or_other_collection will be preserved. That way you can “append” a … Read more