0

If i have a collection in mongodb with employee personal information like name, id, address...

and a second collection with the employee job information like name, id, shift, job title...

how would i get the employee shift and address to display to an html/ejs page. would that be done in the express routes or in the module.js file? can i somehow merge the two collections on the id number that is the same like you can in sql with join statements?

when you create the schema can you pull data from another schema?

  • 1
    Does this answer your question? [Mongoose/mongoDB query joins.. but I come from a sql background](https://stackoverflow.com/questions/14363065/mongoose-mongodb-query-joins-but-i-come-from-a-sql-background) You need to define schemas & use `.populate()` of mongoose or `$lookup` of MongoDB's native aggregation stage to do joins ! – whoami - fakeFaceTrueSoul May 17 '20 at 02:47
  • 1
    I will look into this whoami thank you. this should get me started in the right direction. – Curious_Cat May 17 '20 at 14:54

0 Answers0