How to connect two collections using a foreign key?

Sorry guys silly question. I’m coming from mySQL relational databases but am really excited about MongoDB. I have two tables (collections)


  • Course Name
  • Instructor ID


  • Instructor Name
  • Instructor ID

I’d like to iterate over the Courses collections and return all the courses with these fields:
-Course Name

  • and the - Instructor Name (from the Instructors collection for the particular course based off the Instructor ID)

With MySQL I can use SQL to do the query and send all to json.

What’s the concept to do this with Node JS and mongodb?

It seems what you’re looking for here is a $lookup stage.