Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to reduce number of documents to be sync from a mongo DB
    primarykey
    data
    text
    <p>In my current project, I am using two databases.</p> <ol> <li>A MongoDB instance gathering data from different data providers (abt 15M documents)</li> <li>Another (relational) database instance holding only the data which is needed for the application, i.e. a subset of the data in the MongoDB instance. (abt 5M rows)</li> </ol> <p>As part of the synchronisation process, I need to regularly check for new entries in the MongoDB depending on data in the relational DB.</p> <p>Let's say, this is about songs and artists, a document in the MongoDB might look like this:</p> <pre><code>{_id:1,artists:["Simon","Garfunkel"],"name":"El Condor Pasa"} </code></pre> <p>Part of the sync process is to import/update all songs from those artists that already exist in the relational DB, which are currently about 1M artists.</p> <p>So how do I retrieve all songs of 1M named artists from MongoDB for import?</p> <p>My first thought (and try) was to over all artists and query all songs for each artist (of course, there's an index on the "artists" field). But this takes several minutes for each batch of 1.000 artists, which would make this process a long runner.</p> <p>My second thought was to write all existing artists to a separate mongoDB collection and have a super query which only retrieves songs of artists that are stored in there. But so far I have not been able retrieve data based on two collections. Is this a good use case for map/reduce? If yes, can someone pls. give me a hint on how to achieve this? (I am not completely new to NoSQL, but sort of a newbie when it comes to map/reduce.) Or is this idea just crazy and I have to stick with a process that's running for several days?</p> <p>Thanks in advance for any hints.</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.
    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