Mongodb migration and appending data to existing database
In mongoshell you can connect to several databases and use them at the same time. A plain simple copy would be this one:
var db_A = Mongo(&quot;mongodb://user:password@host-A&quot;).getDB(&quot;data&quot;)
var db_B = Mongo(&quot;mongodb://user:password@host-B&quot;).getDB(&quot;data&quot;)

var docs = db_A.getCollection(&quot;collection_name&quot;).find().toArray();
if (docs.length &gt; 0) {
    db_B.getCollection(&quot;collection_name&quot;).insertMany(docs, {ordered: false});
}

Your migration script will look more complex of course, but that's the way you can do it.