backup – Mongodb migration and appending data to existing database

I have two databases in two different machines containing data in same schema. Both have relational mappings in form of ObjectIDs as it is done in NoSQL database. The task at hand is to pick one database from machine A and append that data to another database residing in the machine B. If I simply insert the data there will be ObjectID collisions and it simply won’t work.
The only option which I see is to insert the primary key collections first in the database, then insert the collections containing the foreign key mappings and replace the ObjectIDs with the newly created ObjectIDs from the primary key documents. However, it isn’t as easy as it sounds because there are multiple collections which are interconnected with ObjectIDs.

Please suggest me the most efficient way in which this can be done. TIA