How does mongodb transfer data between two tables

  node.js, question

How should data from one table be transferred to another table in mongodb? Please, not stint, thank you first.

Under the same Mongodb instance:

use db_source;
 var docs = db_source.collection_souce.find();
 use db_target;
 docs.forEach(function(d){db.collection_target.insert(d)});

Between different Mongodb instances

Mongodump and mongorestore can be used.

Backup:

mongodump -h host:port -d db_source -c collection_source

Recovery

mongorestore -h host:port -d db_target -c collection_target dump/collection_source.bson

Please refer to the detailed usage of the two tools.

mongodump — MongoDB Manual 3.2