1
0
mirror of https://github.com/balkian/gists.git synced 2024-11-21 17:22:29 +00:00
gists/Copy one collection from a database to another in the same MongoDB/copyMongo.js
J. Fernando Sánchez f48bab94dd Move files
2021-10-30 15:23:01 +02:00

1 line
118 B
JavaScript

db.<collection_name>.find().forEach(function(d){ db.getSiblingDB('<new_database>')['<collection_name>'].insert(d); });