This answer is outdated. Since version 3.2, MongoDB has limited support for left outer joins with the $lookup aggregation operator
MongoDB does not do queries which span multiple collections – period. When you need to join data from multiple collections, you have to do it on the application level by doing multiple queries.
- Query collection A
- Get the secondary keys from the result and put them into an array
- Query collection B passing that array as the value of the $in-operator
- Join the results of both queries programmatically on the application layer
Having to do this should be rather the exception than the norm. When you frequently need to emulate JOINs like that, it either means that you are still thinking too relational when you design your database schema or that your data is simply not suited for the document-based storage concept of MongoDB.