Search code examples
databasemongodbcollectionsdocumentmongodb-compass

Can we join two collections from different database in MongoDB


I want to join two different collection from diffrent database so please let me know is it possible we can join two collection of diffrent database?


Solution

  • There is no concept of joins in MongoDB, instead, there is a concept of aggregations, but this is applicable only in the same DB. for different Database you should consider doing it manually on the service layer of your app