1

I have two tables with this format:

Table 1 - domains

tag0 | tag1 | url | title | domain

Table 2 -favicons

domain | favicon_local

I do a basic join to get the data that I need as such:

  const query = `SELECT domains.*, favicons.favicon_local `
              + `FROM domains `
              + `JOIN favicons ON domains.domain=favicons.domain `
              + `ORDER BY domains.tag0`;

I want to create the same table in Mongoose/MongoDB.

How would I do this port. Should I just create a single Schema with all 6 columns?

And then somehow take the JOIN data and insert it directly into Mongoose?

  • If this is one time thing then you already answered your question. If this is periodic thing and you want to emulate SQL join mongo then this link might help https://stackoverflow.com/questions/2350495/how-do-i-perform-the-sql-join-equivalent-in-mongodb – Amit Yadav Apr 02 '18 at 05:52

0 Answers0