0

I have two tables in Mongo - users and departments, and we want to get users and the related department (using department_id from users table) .

Using MySQL, I can just make a simple join on department_id.

But, how can I do the same in MongoDB?

kiddorails
  • 12,961
  • 2
  • 32
  • 41
Aouidane Med Amine
  • 1,571
  • 16
  • 17
  • 1
    You should read [`$lookup`](https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/) && [How do I perform the SQL Join equivalent in MongoDB?](https://stackoverflow.com/questions/2350495/how-do-i-perform-the-sql-join-equivalent-in-mongodb) – Ashh Jun 16 '18 at 18:01
  • Possible duplicate of [How do I perform the SQL Join equivalent in MongoDB?](https://stackoverflow.com/questions/2350495/how-do-i-perform-the-sql-join-equivalent-in-mongodb) – Ashh Jun 16 '18 at 18:02

0 Answers0