Note that there are some explanatory texts on larger screens.

plurals
  1. POMongoDB: How to merge two collections/databases together into one?
    primarykey
    data
    text
    <p>First please note this question is different from the following two</p> <p><a href="https://stackoverflow.com/questions/5681851/mongodb-combine-data-from-multiple-collections-in-to-one-how">MongoDB: Combine data from multiple collections into one..how?</a></p> <p><a href="https://stackoverflow.com/questions/9696940/merging-two-collections-in-mongodb">Merging two collections in MongoDB</a></p> <p><a href="https://stackoverflow.com/questions/4067197/mongodb-and-joins">MongoDB and &quot;joins&quot;</a></p> <p>I will explain as follows:</p> <p>I have two databases named: <code>DB_A</code> and <code>DB_B</code> in my mongodb. </p> <p>Each database has one collection with same name called <code>store</code>. </p> <p>Both collections have lots lots of docs that have exactly the same structure {key:"key1", value:"value1"}, etc.</p> <p>Actually, I was supposed to only create <code>DB_A</code> and insert all docs into <code>DB_A</code>. But later when I did my second round of inserting, I made a mistake by typing the wrong name as the database name.</p> <p>So now, each database has size of 32GB, I wish to merge two databases.</p> <p>One problem/constraint is that the free space available now is only 15GB, so I can't just <code>copy</code> all things from <code>DB_B</code> to <code>DB_A</code>. </p> <p>I am wondering whether I can do <code>move</code>? or what is the simplest / best / <strong>fast</strong> way to merge the two simple databases? I prefer the most efficient way as simply reinserting 32GB into <code>DB_A</code> will take quite a time.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload